Merge branch 'chandrikamohith-MIFOSX-1992' into develop
This commit is contained in:
@@ -15735,6 +15735,16 @@ GET https://DomainName/api/v1/accountnumberformats/template
|
|||||||
"id": 3,
|
"id": 3,
|
||||||
"code": "accountType.savings",
|
"code": "accountType.savings",
|
||||||
"value": "SAVINGS"
|
"value": "SAVINGS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"code": "accountType.center",
|
||||||
|
"value": "CENTER"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"code": "accountType.group",
|
||||||
|
"value": "GROUP"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prefixTypeOptions":
|
"prefixTypeOptions":
|
||||||
@@ -15777,6 +15787,22 @@ GET https://DomainName/api/v1/accountnumberformats/template
|
|||||||
"code": "accountNumberPrefixType.officeName",
|
"code": "accountNumberPrefixType.officeName",
|
||||||
"value": "OFFICE_NAME"
|
"value": "OFFICE_NAME"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"accountType.center":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"code": "accountNumberPrefixType.officeName",
|
||||||
|
"value": "OFFICE_NAME"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"accountType.group":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"code": "accountNumberPrefixType.officeName",
|
||||||
|
"value": "OFFICE_NAME"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+77
-2
@@ -5,14 +5,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.integrationtests;
|
package org.mifosplatform.integrationtests;
|
||||||
|
|
||||||
|
import java.sql.Timestamp;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.mifosplatform.integrationtests.common.CenterDomain;
|
||||||
|
import org.mifosplatform.integrationtests.common.CenterHelper;
|
||||||
import org.mifosplatform.integrationtests.common.ClientHelper;
|
import org.mifosplatform.integrationtests.common.ClientHelper;
|
||||||
import org.mifosplatform.integrationtests.common.CommonConstants;
|
import org.mifosplatform.integrationtests.common.CommonConstants;
|
||||||
|
import org.mifosplatform.integrationtests.common.GroupHelper;
|
||||||
|
import org.mifosplatform.integrationtests.common.OfficeHelper;
|
||||||
import org.mifosplatform.integrationtests.common.Utils;
|
import org.mifosplatform.integrationtests.common.Utils;
|
||||||
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
|
import org.mifosplatform.integrationtests.common.loans.LoanApplicationTestBuilder;
|
||||||
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
|
import org.mifosplatform.integrationtests.common.loans.LoanProductTestBuilder;
|
||||||
@@ -53,6 +58,8 @@ public class AccountNumberPreferencesTest {
|
|||||||
private Integer clientAccountNumberPreferenceId;
|
private Integer clientAccountNumberPreferenceId;
|
||||||
private Integer loanAccountNumberPreferenceId;
|
private Integer loanAccountNumberPreferenceId;
|
||||||
private Integer savingsAccountNumberPreferenceId;
|
private Integer savingsAccountNumberPreferenceId;
|
||||||
|
private Integer groupsAccountNumberPreferenceId;
|
||||||
|
private Integer centerAccountNumberPreferenceId;
|
||||||
private final String MINIMUM_OPENING_BALANCE = "1000.0";
|
private final String MINIMUM_OPENING_BALANCE = "1000.0";
|
||||||
private final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
private final String ACCOUNT_TYPE_INDIVIDUAL = "INDIVIDUAL";
|
||||||
private Boolean isAccountPreferenceSetUp = false;
|
private Boolean isAccountPreferenceSetUp = false;
|
||||||
@@ -63,7 +70,10 @@ public class AccountNumberPreferencesTest {
|
|||||||
private final String officeName = "OFFICE_NAME";
|
private final String officeName = "OFFICE_NAME";
|
||||||
private final String loanShortName = "LOAN_PRODUCT_SHORT_NAME";
|
private final String loanShortName = "LOAN_PRODUCT_SHORT_NAME";
|
||||||
private final String savingsShortName = "SAVINGS_PRODUCT_SHORT_NAME";
|
private final String savingsShortName = "SAVINGS_PRODUCT_SHORT_NAME";
|
||||||
|
private Integer groupID;
|
||||||
|
private Integer centerId;
|
||||||
|
private String groupAccountNo;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Utils.initializeRESTAssured();
|
Utils.initializeRESTAssured();
|
||||||
@@ -143,6 +153,8 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.createAndValidateClientEntity(this.isAccountPreferenceSetUp);
|
this.createAndValidateClientEntity(this.isAccountPreferenceSetUp);
|
||||||
this.createAndValidateLoanEntity(this.isAccountPreferenceSetUp);
|
this.createAndValidateLoanEntity(this.isAccountPreferenceSetUp);
|
||||||
this.createAndValidateSavingsEntity(this.isAccountPreferenceSetUp);
|
this.createAndValidateSavingsEntity(this.isAccountPreferenceSetUp);
|
||||||
|
this.createAndValidateGroup(this.isAccountPreferenceSetUp);
|
||||||
|
this.createAndValidateCenter(this.isAccountPreferenceSetUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateAccountNumberGenerationWithPreferences() {
|
private void validateAccountNumberGenerationWithPreferences() {
|
||||||
@@ -150,6 +162,8 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.createAndValidateClientEntity(this.isAccountPreferenceSetUp);
|
this.createAndValidateClientEntity(this.isAccountPreferenceSetUp);
|
||||||
this.createAndValidateLoanEntity(this.isAccountPreferenceSetUp);
|
this.createAndValidateLoanEntity(this.isAccountPreferenceSetUp);
|
||||||
this.createAndValidateSavingsEntity(this.isAccountPreferenceSetUp);
|
this.createAndValidateSavingsEntity(this.isAccountPreferenceSetUp);
|
||||||
|
this.createAndValidateGroup(this.isAccountPreferenceSetUp);
|
||||||
|
this.createAndValidateCenter(this.isAccountPreferenceSetUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createAccountNumberPreference() {
|
private void createAccountNumberPreference() {
|
||||||
@@ -164,9 +178,18 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
|
this.savingsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createSavingsAccountNumberPreference(
|
||||||
this.responseSpec, "resourceId");
|
this.responseSpec, "resourceId");
|
||||||
System.out.println("Successfully created account number preferences for Savings (ID: " + this.savingsAccountNumberPreferenceId);
|
System.out.println("Successfully created account number preferences for Savings (ID: " + this.savingsAccountNumberPreferenceId);
|
||||||
|
|
||||||
|
this.groupsAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createGroupsAccountNumberPreference(
|
||||||
|
this.responseSpec, "resourceId");
|
||||||
|
System.out.println("Successfully created account number preferences for Groups (ID: " + this.groupsAccountNumberPreferenceId);
|
||||||
|
|
||||||
|
this.centerAccountNumberPreferenceId = (Integer) this.accountNumberPreferencesHelper.createCenterAccountNumberPreference(
|
||||||
|
this.responseSpec, "resourceId");
|
||||||
|
System.out.println("Successfully created account number preferences for Center (ID: " + this.centerAccountNumberPreferenceId);
|
||||||
|
|
||||||
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
|
this.accountNumberPreferencesHelper.verifyCreationOfAccountNumberPreferences(this.clientAccountNumberPreferenceId,
|
||||||
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.responseSpec, this.requestSpec);
|
this.loanAccountNumberPreferenceId, this.savingsAccountNumberPreferenceId, this.groupsAccountNumberPreferenceId,
|
||||||
|
this.centerAccountNumberPreferenceId, this.responseSpec, this.requestSpec);
|
||||||
|
|
||||||
this.createAccountNumberPreferenceInvalidData("1000", "1001");
|
this.createAccountNumberPreferenceInvalidData("1000", "1001");
|
||||||
this.createAccountNumberPreferenceDuplicateData("1", "101");
|
this.createAccountNumberPreferenceDuplicateData("1", "101");
|
||||||
@@ -242,6 +265,58 @@ public class AccountNumberPreferencesTest {
|
|||||||
this.createAndValidateClientWithoutAccountPreference();
|
this.createAndValidateClientWithoutAccountPreference();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createAndValidateGroup(Boolean isAccountPreferenceSetUp) {
|
||||||
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
this.groupID = GroupHelper.createGroup(this.requestSpec, this.responseSpec);
|
||||||
|
GroupHelper.verifyGroupCreatedOnServer(this.requestSpec, this.responseSpec, groupID);
|
||||||
|
|
||||||
|
this.groupID = GroupHelper.activateGroup(this.requestSpec, this.responseSpec, groupID.toString());
|
||||||
|
GroupHelper.verifyGroupActivatedOnServer(this.requestSpec, this.responseSpec, groupID, true);
|
||||||
|
|
||||||
|
final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + this.groupID + "?" + Utils.TENANT_IDENTIFIER;
|
||||||
|
this.groupAccountNo = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "accountNo");
|
||||||
|
|
||||||
|
if (isAccountPreferenceSetUp) {
|
||||||
|
String groupsPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||||
|
this.groupsAccountNumberPreferenceId, "prefixType.value");
|
||||||
|
|
||||||
|
if (groupsPrefixName.equals(this.officeName)) {
|
||||||
|
|
||||||
|
final String groupOfficeName = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "officeName");
|
||||||
|
|
||||||
|
this.validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, groupOfficeName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
validateAccountNumberLengthAndStartsWithPrefix(this.groupAccountNo, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createAndValidateCenter(Boolean isAccountPreferenceSetUp) {
|
||||||
|
this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
|
||||||
|
Integer officeId = new OfficeHelper(requestSpec, responseSpec).createOffice("01 July 2007");
|
||||||
|
|
||||||
|
String name = "CenterCreation" + new Timestamp(new java.util.Date().getTime());
|
||||||
|
this.centerId = CenterHelper.createCenter(name, officeId, requestSpec, responseSpec);
|
||||||
|
CenterDomain center = CenterHelper.retrieveByID(centerId, requestSpec, responseSpec);
|
||||||
|
Assert.assertNotNull(center);
|
||||||
|
Assert.assertTrue(center.getName().equals(name));
|
||||||
|
|
||||||
|
if (isAccountPreferenceSetUp) {
|
||||||
|
String centerPrefixName = (String) this.accountNumberPreferencesHelper.getAccountNumberPreference(
|
||||||
|
this.centerAccountNumberPreferenceId, "prefixType.value");
|
||||||
|
final String CENTER_URL = "/mifosng-provider/api/v1/groups/" + this.centerId + "?" + Utils.TENANT_IDENTIFIER;
|
||||||
|
|
||||||
|
if (centerPrefixName.equals(this.officeName)) {
|
||||||
|
final String centerOfficeName = Utils.performServerGet(requestSpec, responseSpec, CENTER_URL, "officeName");
|
||||||
|
|
||||||
|
this.validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), centerOfficeName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
validateAccountNumberLengthAndStartsWithPrefix(center.getAccountNo(), null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void createAndValidateClientWithoutAccountPreference() {
|
private void createAndValidateClientWithoutAccountPreference() {
|
||||||
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
this.clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||||
|
|||||||
+10
-2
@@ -17,6 +17,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
|||||||
public static class Builder {
|
public static class Builder {
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
private String accountNo;
|
||||||
private HashMap status;
|
private HashMap status;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private String name;
|
private String name;
|
||||||
@@ -31,6 +32,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
|||||||
final String name, final String externalId, final Integer staffId, final int officeID, final String officeName,
|
final String name, final String externalId, final Integer staffId, final int officeID, final String officeName,
|
||||||
final String hierarchy, final ArrayList<HashMap> groupMembers) {
|
final String hierarchy, final ArrayList<HashMap> groupMembers) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.accountNo = accountNo;
|
||||||
this.status = new HashMap();
|
this.status = new HashMap();
|
||||||
this.status.put("id", statusid);
|
this.status.put("id", statusid);
|
||||||
this.status.put("code", statuscode);
|
this.status.put("code", statuscode);
|
||||||
@@ -46,7 +48,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public CenterDomain build() {
|
public CenterDomain build() {
|
||||||
return new CenterDomain(this.id, (int) this.status.get("id"), (String) this.status.get("code"),
|
return new CenterDomain(this.id, this.accountNo, (int) this.status.get("id"), (String) this.status.get("code"),
|
||||||
(String) this.status.get("value"), this.active, this.name, this.externalId, this.staffId, this.officeId,
|
(String) this.status.get("value"), this.active, this.name, this.externalId, this.staffId, this.officeId,
|
||||||
this.officeName, this.hierarchy, groupMembers);
|
this.officeName, this.hierarchy, groupMembers);
|
||||||
}
|
}
|
||||||
@@ -54,6 +56,7 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
private String accountNo;
|
||||||
private HashMap status;
|
private HashMap status;
|
||||||
private boolean active;
|
private boolean active;
|
||||||
private String name;
|
private String name;
|
||||||
@@ -68,10 +71,11 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
|||||||
/* super(); */
|
/* super(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
private CenterDomain(final Integer id, final Integer statusid, final String statuscode, final String statusvalue, final boolean active,
|
private CenterDomain(final Integer id, final String accountNo, final Integer statusid, final String statuscode, final String statusvalue, final boolean active,
|
||||||
final String name, final String externalId, final Integer staffId, final Integer officeID, final String officeName,
|
final String name, final String externalId, final Integer staffId, final Integer officeID, final String officeName,
|
||||||
final String hierarchy, final ArrayList<HashMap> groupMembers) {
|
final String hierarchy, final ArrayList<HashMap> groupMembers) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.accountNo = accountNo;
|
||||||
this.status = new HashMap();
|
this.status = new HashMap();
|
||||||
this.status.put("id", statusid);
|
this.status.put("id", statusid);
|
||||||
this.status.put("code", statuscode);
|
this.status.put("code", statuscode);
|
||||||
@@ -180,6 +184,10 @@ public class CenterDomain implements Comparable<CenterDomain> {
|
|||||||
public String getHierarchy() {
|
public String getHierarchy() {
|
||||||
return this.hierarchy;
|
return this.hierarchy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAccountNo(){
|
||||||
|
return this.accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
public int[] getGroupMembers() {
|
public int[] getGroupMembers() {
|
||||||
int[] groupMemberList = new int[this.groupMembers.size()];
|
int[] groupMemberList = new int[this.groupMembers.size()];
|
||||||
|
|||||||
+44
@@ -71,6 +71,36 @@ public class AccountNumberPreferencesHelper {
|
|||||||
requestJSON, jsonAttributeToGetBack);
|
requestJSON, jsonAttributeToGetBack);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object createGroupsAccountNumberPreference(
|
||||||
|
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
|
||||||
|
System.out
|
||||||
|
.println("---------------------------------CREATING GROUPS ACCOUNT NUMBER PREFERENCE------------------------------------------");
|
||||||
|
|
||||||
|
final String requestJSON = new AccountNumberPreferencesTestBuilder()
|
||||||
|
.groupsBuild();
|
||||||
|
|
||||||
|
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
|
||||||
|
+ Utils.TENANT_IDENTIFIER;
|
||||||
|
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
|
||||||
|
requestJSON, jsonAttributeToGetBack);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object createCenterAccountNumberPreference(
|
||||||
|
ResponseSpecification responseSpec, String jsonAttributeToGetBack) {
|
||||||
|
System.out
|
||||||
|
.println("---------------------------------CREATING CENTER ACCOUNT NUMBER PREFERENCE------------------------------------------");
|
||||||
|
|
||||||
|
final String requestJSON = new AccountNumberPreferencesTestBuilder()
|
||||||
|
.centerBuild();
|
||||||
|
|
||||||
|
final String URL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "?"
|
||||||
|
+ Utils.TENANT_IDENTIFIER;
|
||||||
|
return Utils.performServerPost(this.requestSpec, responseSpec, URL,
|
||||||
|
requestJSON, jsonAttributeToGetBack);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public HashMap<String, Object> createAccountNumberPreferenceWithInvalidData(
|
public HashMap<String, Object> createAccountNumberPreferenceWithInvalidData(
|
||||||
ResponseSpecification responseSpec, String accountType,
|
ResponseSpecification responseSpec, String accountType,
|
||||||
@@ -137,6 +167,8 @@ public class AccountNumberPreferencesHelper {
|
|||||||
final Integer clientAccountNumberPreferenceId,
|
final Integer clientAccountNumberPreferenceId,
|
||||||
final Integer loanAccountNumberPreferenceId,
|
final Integer loanAccountNumberPreferenceId,
|
||||||
final Integer savingsAccountNumberPreferenceId,
|
final Integer savingsAccountNumberPreferenceId,
|
||||||
|
final Integer groupsAccountNumberPreferenceId,
|
||||||
|
final Integer centerAccountNumberPreferenceId,
|
||||||
ResponseSpecification responseSpec, RequestSpecification requestSpec) {
|
ResponseSpecification responseSpec, RequestSpecification requestSpec) {
|
||||||
|
|
||||||
final String clientURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
|
final String clientURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
|
||||||
@@ -155,6 +187,18 @@ public class AccountNumberPreferencesHelper {
|
|||||||
+ Utils.TENANT_IDENTIFIER;
|
+ Utils.TENANT_IDENTIFIER;
|
||||||
|
|
||||||
Utils.performServerGet(requestSpec, responseSpec, savingsURL, "id");
|
Utils.performServerGet(requestSpec, responseSpec, savingsURL, "id");
|
||||||
|
|
||||||
|
final String groupsURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
|
||||||
|
+ groupsAccountNumberPreferenceId + "?"
|
||||||
|
+ Utils.TENANT_IDENTIFIER;
|
||||||
|
|
||||||
|
Utils.performServerGet(requestSpec, responseSpec, groupsURL, "id");
|
||||||
|
|
||||||
|
final String centerURL = ACCOUNT_NUMBER_FORMATS_REQUEST_URL + "/"
|
||||||
|
+ centerAccountNumberPreferenceId + "?"
|
||||||
|
+ Utils.TENANT_IDENTIFIER;
|
||||||
|
|
||||||
|
Utils.performServerGet(requestSpec, responseSpec, centerURL, "id");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyUpdationOfAccountNumberPreferences(
|
public void verifyUpdationOfAccountNumberPreferences(
|
||||||
|
|||||||
+20
@@ -16,6 +16,10 @@ public class AccountNumberPreferencesTestBuilder {
|
|||||||
private String loanPrefixType = "1";
|
private String loanPrefixType = "1";
|
||||||
private String savingsAccountType = "3";
|
private String savingsAccountType = "3";
|
||||||
private String savingsPrefixType = "1";
|
private String savingsPrefixType = "1";
|
||||||
|
private String centerAccountType = "4";
|
||||||
|
private String centerPrefixType = "1";
|
||||||
|
private String groupsAccountType = "5";
|
||||||
|
private String groupsPrefixType = "1";
|
||||||
|
|
||||||
public String clientBuild() {
|
public String clientBuild() {
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
@@ -40,7 +44,23 @@ public class AccountNumberPreferencesTestBuilder {
|
|||||||
|
|
||||||
return new Gson().toJson(map);
|
return new Gson().toJson(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String groupsBuild() {
|
||||||
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("accountType", groupsAccountType);
|
||||||
|
map.put("prefixType", groupsPrefixType);
|
||||||
|
|
||||||
|
return new Gson().toJson(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String centerBuild() {
|
||||||
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("accountType", centerAccountType);
|
||||||
|
map.put("prefixType", centerPrefixType);
|
||||||
|
|
||||||
|
return new Gson().toJson(map);
|
||||||
|
}
|
||||||
|
|
||||||
public String invalidDataBuild(String accountType, String prefixType) {
|
public String invalidDataBuild(String accountType, String prefixType) {
|
||||||
final HashMap<String, Object> map = new HashMap<>();
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("accountType", accountType);
|
map.put("accountType", accountType);
|
||||||
|
|||||||
+21
-13
@@ -86,23 +86,31 @@ public class AccountNumberFormatDataValidator {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Integer> determineValidAccountNumberPrefixes(EntityAccountType entityAccountType) {
|
public Set<Integer> determineValidAccountNumberPrefixes(
|
||||||
Set<AccountNumberPrefixType> validAccountNumberPrefixes = new HashSet<>();
|
EntityAccountType entityAccountType) {
|
||||||
|
Set<AccountNumberPrefixType> validAccountNumberPrefixes = new HashSet<>();
|
||||||
|
|
||||||
switch (entityAccountType) {
|
switch (entityAccountType) {
|
||||||
case CLIENT:
|
case CLIENT:
|
||||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForClientAccounts;
|
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForClientAccounts;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOAN:
|
case LOAN:
|
||||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForLoanAccounts;
|
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForLoanAccounts;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SAVINGS:
|
case SAVINGS:
|
||||||
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForSavingsAccounts;
|
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForSavingsAccounts;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
case CENTER:
|
||||||
|
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForCenters;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GROUP:
|
||||||
|
validAccountNumberPrefixes = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
Set<Integer> validAccountNumberPrefixValues = new HashSet<>();
|
Set<Integer> validAccountNumberPrefixValues = new HashSet<>();
|
||||||
for (AccountNumberPrefixType validAccountNumberPrefix : validAccountNumberPrefixes) {
|
for (AccountNumberPrefixType validAccountNumberPrefix : validAccountNumberPrefixes) {
|
||||||
|
|||||||
+4
@@ -23,6 +23,10 @@ public class AccountNumberFormatEnumerations {
|
|||||||
AccountNumberPrefixType.OFFICE_NAME, AccountNumberPrefixType.LOAN_PRODUCT_SHORT_NAME));
|
AccountNumberPrefixType.OFFICE_NAME, AccountNumberPrefixType.LOAN_PRODUCT_SHORT_NAME));
|
||||||
public final static Set<AccountNumberPrefixType> accountNumberPrefixesForSavingsAccounts = new HashSet<>(Arrays.asList(
|
public final static Set<AccountNumberPrefixType> accountNumberPrefixesForSavingsAccounts = new HashSet<>(Arrays.asList(
|
||||||
AccountNumberPrefixType.OFFICE_NAME, AccountNumberPrefixType.SAVINGS_PRODUCT_SHORT_NAME));
|
AccountNumberPrefixType.OFFICE_NAME, AccountNumberPrefixType.SAVINGS_PRODUCT_SHORT_NAME));
|
||||||
|
public final static Set<AccountNumberPrefixType> accountNumberPrefixesForCenters = new HashSet<>(Arrays.asList(
|
||||||
|
AccountNumberPrefixType.OFFICE_NAME));
|
||||||
|
public final static Set<AccountNumberPrefixType> accountNumberPrefixesForGroups = new HashSet<>(Arrays.asList(
|
||||||
|
AccountNumberPrefixType.OFFICE_NAME));
|
||||||
|
|
||||||
public enum AccountNumberPrefixType {
|
public enum AccountNumberPrefixType {
|
||||||
OFFICE_NAME(1, "accountNumberPrefixType.officeName"), CLIENT_TYPE(101, "accountNumberPrefixType.clientType"), LOAN_PRODUCT_SHORT_NAME(
|
OFFICE_NAME(1, "accountNumberPrefixType.officeName"), CLIENT_TYPE(101, "accountNumberPrefixType.clientType"), LOAN_PRODUCT_SHORT_NAME(
|
||||||
|
|||||||
+10
-1
@@ -9,7 +9,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public enum EntityAccountType {
|
public enum EntityAccountType {
|
||||||
CLIENT(1, "accountType.client"), LOAN(2, "accountType.loan"), SAVINGS(3, "accountType.savings");
|
CLIENT(1, "accountType.client"), LOAN(2, "accountType.loan"), SAVINGS(3, "accountType.savings"), CENTER(4, "accountType.center"),
|
||||||
|
GROUP(5, "accountType.group");
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String code;
|
private final String code;
|
||||||
@@ -76,5 +77,13 @@ public enum EntityAccountType {
|
|||||||
public boolean isSavingsAccount() {
|
public boolean isSavingsAccount() {
|
||||||
return this.value.equals(EntityAccountType.SAVINGS.getValue());
|
return this.value.equals(EntityAccountType.SAVINGS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isCenterAccount(){
|
||||||
|
return this.value.equals(EntityAccountType.CENTER.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isGroupAccount(){
|
||||||
|
return this.value.equals(EntityAccountType.GROUP.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -127,6 +127,12 @@ public class AccountNumberFormatReadPlatformServiceImpl implements AccountNumber
|
|||||||
case SAVINGS:
|
case SAVINGS:
|
||||||
accountNumberPrefixTypesSet = AccountNumberFormatEnumerations.accountNumberPrefixesForSavingsAccounts;
|
accountNumberPrefixTypesSet = AccountNumberFormatEnumerations.accountNumberPrefixesForSavingsAccounts;
|
||||||
break;
|
break;
|
||||||
|
case CENTER :
|
||||||
|
accountNumberPrefixTypesSet = AccountNumberFormatEnumerations.accountNumberPrefixesForCenters;
|
||||||
|
break;
|
||||||
|
case GROUP :
|
||||||
|
accountNumberPrefixTypesSet = AccountNumberFormatEnumerations.accountNumberPrefixesForGroups;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Object[] array = accountNumberPrefixTypesSet.toArray();
|
Object[] array = accountNumberPrefixTypesSet.toArray();
|
||||||
|
|||||||
+16
@@ -12,6 +12,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.mifosplatform.infrastructure.accountnumberformat.domain.AccountNumberFormat;
|
import org.mifosplatform.infrastructure.accountnumberformat.domain.AccountNumberFormat;
|
||||||
import org.mifosplatform.infrastructure.accountnumberformat.domain.AccountNumberFormatEnumerations.AccountNumberPrefixType;
|
import org.mifosplatform.infrastructure.accountnumberformat.domain.AccountNumberFormatEnumerations.AccountNumberPrefixType;
|
||||||
import org.mifosplatform.infrastructure.codes.domain.CodeValue;
|
import org.mifosplatform.infrastructure.codes.domain.CodeValue;
|
||||||
|
import org.mifosplatform.portfolio.group.domain.Group;
|
||||||
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
|
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
|
||||||
import org.mifosplatform.portfolio.savings.domain.SavingsAccount;
|
import org.mifosplatform.portfolio.savings.domain.SavingsAccount;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -89,5 +90,20 @@ public class AccountNumberGenerator {
|
|||||||
}
|
}
|
||||||
return accountNumber;
|
return accountNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String generateGroupAccountNumber(Group group, AccountNumberFormat accountNumberFormat) {
|
||||||
|
Map<String, String> propertyMap = new HashMap<>();
|
||||||
|
propertyMap.put(ID, group.getId().toString());
|
||||||
|
propertyMap.put(OFFICE_NAME, group.getOffice().getName());
|
||||||
|
return generateAccountNumber(propertyMap, accountNumberFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String generateCenterAccountNumber(Group group, AccountNumberFormat accountNumberFormat) {
|
||||||
|
Map<String, String> propertyMap = new HashMap<>();
|
||||||
|
propertyMap.put(ID, group.getId().toString());
|
||||||
|
propertyMap.put(OFFICE_NAME, group.getOffice().getName());
|
||||||
|
return generateAccountNumber(propertyMap, accountNumberFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+3
-2
@@ -563,7 +563,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
private static final class ParentGroupsMapper implements RowMapper<GroupGeneralData> {
|
private static final class ParentGroupsMapper implements RowMapper<GroupGeneralData> {
|
||||||
|
|
||||||
public String parentGroupsSchema() {
|
public String parentGroupsSchema() {
|
||||||
return "gp.id As groupId , gp.display_name As groupName from m_client cl JOIN m_group_client gc ON cl.id = gc.client_id "
|
return "gp.id As groupId , gp.account_no as accountNo, gp.display_name As groupName from m_client cl JOIN m_group_client gc ON cl.id = gc.client_id "
|
||||||
+ "JOIN m_group gp ON gp.id = gc.group_id WHERE cl.id = ?";
|
+ "JOIN m_group gp ON gp.id = gc.group_id WHERE cl.id = ?";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,8 +572,9 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
|
|||||||
|
|
||||||
final Long groupId = JdbcSupport.getLong(rs, "groupId");
|
final Long groupId = JdbcSupport.getLong(rs, "groupId");
|
||||||
final String groupName = rs.getString("groupName");
|
final String groupName = rs.getString("groupName");
|
||||||
|
final String accountNo = rs.getString("accountNo");
|
||||||
|
|
||||||
return GroupGeneralData.lookup(groupId, groupName);
|
return GroupGeneralData.lookup(groupId, accountNo, groupName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -28,6 +28,7 @@ public class GroupingTypesApiConstants {
|
|||||||
public static final String groupIdParamName = "groupId";
|
public static final String groupIdParamName = "groupId";
|
||||||
public static final String clientIdParamName = "clientId";
|
public static final String clientIdParamName = "clientId";
|
||||||
public static final String groupRolesParamName = "groupRoles";
|
public static final String groupRolesParamName = "groupRoles";
|
||||||
|
public static final String accountNoParamName = "accountNo";
|
||||||
|
|
||||||
// general
|
// general
|
||||||
public static final String localeParamName = "locale";
|
public static final String localeParamName = "locale";
|
||||||
|
|||||||
+15
-8
@@ -20,6 +20,7 @@ import org.mifosplatform.portfolio.calendar.data.CalendarData;
|
|||||||
public class CenterData {
|
public class CenterData {
|
||||||
|
|
||||||
private final Long id;
|
private final Long id;
|
||||||
|
private String accountNo;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String externalId;
|
private final String externalId;
|
||||||
private final Long officeId;
|
private final Long officeId;
|
||||||
@@ -44,23 +45,23 @@ public class CenterData {
|
|||||||
private final Collection<OfficeData> officeOptions;
|
private final Collection<OfficeData> officeOptions;
|
||||||
private final Collection<StaffData> staffOptions;
|
private final Collection<StaffData> staffOptions;
|
||||||
|
|
||||||
public static CenterData template(final Long officeId, final LocalDate activationDate, final Collection<OfficeData> officeOptions,
|
public static CenterData template(final Long officeId, final String accountNo, final LocalDate activationDate, final Collection<OfficeData> officeOptions,
|
||||||
final Collection<StaffData> staffOptions, final Collection<GroupGeneralData> groupMembersOptions) {
|
final Collection<StaffData> staffOptions, final Collection<GroupGeneralData> groupMembersOptions) {
|
||||||
final CalendarData collectionMeetingCalendar = null;
|
final CalendarData collectionMeetingCalendar = null;
|
||||||
final Collection<CodeValueData> closureReasons = null;
|
final Collection<CodeValueData> closureReasons = null;
|
||||||
final GroupTimelineData timeline = null;
|
final GroupTimelineData timeline = null;
|
||||||
return new CenterData(null, null, null, null, activationDate, officeId, null, null, null, null, null, officeOptions, staffOptions,
|
return new CenterData(null, accountNo, null, null, null, activationDate, officeId, null, null, null, null, null, officeOptions, staffOptions,
|
||||||
groupMembersOptions, collectionMeetingCalendar, closureReasons, timeline);
|
groupMembersOptions, collectionMeetingCalendar, closureReasons, timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CenterData withTemplate(final CenterData templateCenter, final CenterData center) {
|
public static CenterData withTemplate(final CenterData templateCenter, final CenterData center) {
|
||||||
return new CenterData(center.id, center.name, center.externalId, center.status, center.activationDate, center.officeId,
|
return new CenterData(center.id, center.accountNo, center.name, center.externalId, center.status, center.activationDate, center.officeId,
|
||||||
center.officeName, center.staffId, center.staffName, center.hierarchy, center.groupMembers, templateCenter.officeOptions,
|
center.officeName, center.staffId, center.staffName, center.hierarchy, center.groupMembers, templateCenter.officeOptions,
|
||||||
templateCenter.staffOptions, templateCenter.groupMembersOptions, templateCenter.collectionMeetingCalendar,
|
templateCenter.staffOptions, templateCenter.groupMembersOptions, templateCenter.collectionMeetingCalendar,
|
||||||
templateCenter.closureReasons, center.timeline);
|
templateCenter.closureReasons, center.timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CenterData instance(final Long id, final String name, final String externalId, final EnumOptionData status,
|
public static CenterData instance(final Long id, final String accountNo, final String name, final String externalId, final EnumOptionData status,
|
||||||
final LocalDate activationDate, final Long officeId, final String officeName, final Long staffId, final String staffName,
|
final LocalDate activationDate, final Long officeId, final String officeName, final Long staffId, final String staffName,
|
||||||
final String hierarchy, final GroupTimelineData timeline, final CalendarData collectionMeetingCalendar) {
|
final String hierarchy, final GroupTimelineData timeline, final CalendarData collectionMeetingCalendar) {
|
||||||
|
|
||||||
@@ -70,13 +71,13 @@ public class CenterData {
|
|||||||
final Collection<GroupGeneralData> groupMembersOptions = null;
|
final Collection<GroupGeneralData> groupMembersOptions = null;
|
||||||
final Collection<CodeValueData> closureReasons = null;
|
final Collection<CodeValueData> closureReasons = null;
|
||||||
|
|
||||||
return new CenterData(id, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
return new CenterData(id, accountNo, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
||||||
groupMembers, officeOptions, staffOptions, groupMembersOptions, collectionMeetingCalendar, closureReasons, timeline);
|
groupMembers, officeOptions, staffOptions, groupMembersOptions, collectionMeetingCalendar, closureReasons, timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CenterData withAssociations(final CenterData centerData, final Collection<GroupGeneralData> groupMembers,
|
public static CenterData withAssociations(final CenterData centerData, final Collection<GroupGeneralData> groupMembers,
|
||||||
final CalendarData collectionMeetingCalendar) {
|
final CalendarData collectionMeetingCalendar) {
|
||||||
return new CenterData(centerData.id, centerData.name, centerData.externalId, centerData.status, centerData.activationDate,
|
return new CenterData(centerData.id, centerData.accountNo, centerData.name, centerData.externalId, centerData.status, centerData.activationDate,
|
||||||
centerData.officeId, centerData.officeName, centerData.staffId, centerData.staffName, centerData.hierarchy, groupMembers,
|
centerData.officeId, centerData.officeName, centerData.staffId, centerData.staffName, centerData.hierarchy, groupMembers,
|
||||||
centerData.officeOptions, centerData.staffOptions, centerData.groupMembersOptions, collectionMeetingCalendar,
|
centerData.officeOptions, centerData.staffOptions, centerData.groupMembersOptions, collectionMeetingCalendar,
|
||||||
centerData.closureReasons, centerData.timeline);
|
centerData.closureReasons, centerData.timeline);
|
||||||
@@ -84,6 +85,7 @@ public class CenterData {
|
|||||||
|
|
||||||
public static CenterData withClosureReasons(final Collection<CodeValueData> closureReasons) {
|
public static CenterData withClosureReasons(final Collection<CodeValueData> closureReasons) {
|
||||||
final Long id = null;
|
final Long id = null;
|
||||||
|
final String accountNo = null;
|
||||||
final String name = null;
|
final String name = null;
|
||||||
final String externalId = null;
|
final String externalId = null;
|
||||||
final EnumOptionData status = null;
|
final EnumOptionData status = null;
|
||||||
@@ -99,16 +101,17 @@ public class CenterData {
|
|||||||
final Collection<GroupGeneralData> groupMembersOptions = null;
|
final Collection<GroupGeneralData> groupMembersOptions = null;
|
||||||
final CalendarData collectionMeetingCalendar = null;
|
final CalendarData collectionMeetingCalendar = null;
|
||||||
final GroupTimelineData timeline = null;
|
final GroupTimelineData timeline = null;
|
||||||
return new CenterData(id, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
return new CenterData(id, accountNo, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
||||||
groupMembers, officeOptions, staffOptions, groupMembersOptions, collectionMeetingCalendar, closureReasons, timeline);
|
groupMembers, officeOptions, staffOptions, groupMembersOptions, collectionMeetingCalendar, closureReasons, timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CenterData(final Long id, final String name, final String externalId, final EnumOptionData status,
|
private CenterData(final Long id, final String accountNo, final String name, final String externalId, final EnumOptionData status,
|
||||||
final LocalDate activationDate, final Long officeId, final String officeName, final Long staffId, final String staffName,
|
final LocalDate activationDate, final Long officeId, final String officeName, final Long staffId, final String staffName,
|
||||||
final String hierarchy, final Collection<GroupGeneralData> groupMembers, final Collection<OfficeData> officeOptions,
|
final String hierarchy, final Collection<GroupGeneralData> groupMembers, final Collection<OfficeData> officeOptions,
|
||||||
final Collection<StaffData> staffOptions, final Collection<GroupGeneralData> groupMembersOptions,
|
final Collection<StaffData> staffOptions, final Collection<GroupGeneralData> groupMembersOptions,
|
||||||
final CalendarData collectionMeetingCalendar, final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline) {
|
final CalendarData collectionMeetingCalendar, final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.accountNo = accountNo;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@@ -146,6 +149,10 @@ public class CenterData {
|
|||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAccountNo(){
|
||||||
|
return this.accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
|
|||||||
+18
-11
@@ -22,6 +22,7 @@ import org.mifosplatform.portfolio.client.data.ClientData;
|
|||||||
public class GroupGeneralData {
|
public class GroupGeneralData {
|
||||||
|
|
||||||
private final Long id;
|
private final Long id;
|
||||||
|
private final String accountNo;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String externalId;
|
private final String externalId;
|
||||||
|
|
||||||
@@ -55,15 +56,15 @@ public class GroupGeneralData {
|
|||||||
private final Collection<CodeValueData> closureReasons;
|
private final Collection<CodeValueData> closureReasons;
|
||||||
private final GroupTimelineData timeline;
|
private final GroupTimelineData timeline;
|
||||||
|
|
||||||
public static GroupGeneralData lookup(final Long groupId, final String groupName) {
|
public static GroupGeneralData lookup(final Long groupId, final String accountNo, final String groupName) {
|
||||||
final Collection<ClientData> clientMembers = null;
|
final Collection<ClientData> clientMembers = null;
|
||||||
final Collection<GroupRoleData> groupRoles = null;
|
final Collection<GroupRoleData> groupRoles = null;
|
||||||
final Collection<CodeValueData> closureReasons = null;
|
final Collection<CodeValueData> closureReasons = null;
|
||||||
return new GroupGeneralData(groupId, groupName, null, null, null, null, null, null, null, null, null, null, clientMembers, null, null,
|
return new GroupGeneralData(groupId, accountNo, groupName, null, null, null, null, null, null, null, null, null, null, clientMembers, null, null,
|
||||||
null, null, null, groupRoles, null, null, null, null, closureReasons, null);
|
null, null, null, groupRoles, null, null, null, null, closureReasons, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GroupGeneralData template(final Long officeId, final Long centerId, final String centerName, final Long staffId,
|
public static GroupGeneralData template(final Long officeId, final Long centerId, final String accountNo, final String centerName, final Long staffId,
|
||||||
final String staffName, final Collection<CenterData> centerOptions, final Collection<OfficeData> officeOptions,
|
final String staffName, final Collection<CenterData> centerOptions, final Collection<OfficeData> officeOptions,
|
||||||
final Collection<StaffData> staffOptions, final Collection<ClientData> clientOptions,
|
final Collection<StaffData> staffOptions, final Collection<ClientData> clientOptions,
|
||||||
final Collection<CodeValueData> availableRoles) {
|
final Collection<CodeValueData> availableRoles) {
|
||||||
@@ -72,13 +73,13 @@ public class GroupGeneralData {
|
|||||||
final Collection<GroupRoleData> groupRoles = null;
|
final Collection<GroupRoleData> groupRoles = null;
|
||||||
final Collection<CodeValueData> closureReasons = null;
|
final Collection<CodeValueData> closureReasons = null;
|
||||||
|
|
||||||
return new GroupGeneralData(null, null, null, null, null, officeId, null, centerId, centerName, staffId, staffName, null,
|
return new GroupGeneralData(null, accountNo , null, null, null, null, officeId, null, centerId, centerName, staffId, staffName, null,
|
||||||
clientMembers, null, centerOptions, officeOptions, staffOptions, clientOptions, groupRoles, availableRoles, null, null, null,
|
clientMembers, null, centerOptions, officeOptions, staffOptions, clientOptions, groupRoles, availableRoles, null, null, null,
|
||||||
closureReasons, null);
|
closureReasons, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GroupGeneralData withTemplate(final GroupGeneralData templatedGrouping, final GroupGeneralData grouping) {
|
public static GroupGeneralData withTemplate(final GroupGeneralData templatedGrouping, final GroupGeneralData grouping) {
|
||||||
return new GroupGeneralData(grouping.id, grouping.name, grouping.externalId, grouping.status, grouping.activationDate,
|
return new GroupGeneralData(grouping.id, grouping.accountNo, grouping.name, grouping.externalId, grouping.status, grouping.activationDate,
|
||||||
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
||||||
grouping.hierarchy, grouping.clientMembers, grouping.activeClientMembers, templatedGrouping.centerOptions, templatedGrouping.officeOptions,
|
grouping.hierarchy, grouping.clientMembers, grouping.activeClientMembers, templatedGrouping.centerOptions, templatedGrouping.officeOptions,
|
||||||
templatedGrouping.staffOptions, templatedGrouping.clientOptions, grouping.groupRoles, templatedGrouping.availableRoles,
|
templatedGrouping.staffOptions, templatedGrouping.clientOptions, grouping.groupRoles, templatedGrouping.availableRoles,
|
||||||
@@ -89,14 +90,14 @@ public class GroupGeneralData {
|
|||||||
public static GroupGeneralData withAssocations(final GroupGeneralData grouping, final Collection<ClientData> membersOfGroup,
|
public static GroupGeneralData withAssocations(final GroupGeneralData grouping, final Collection<ClientData> membersOfGroup,
|
||||||
final Collection<ClientData> activeClientMembers, final Collection<GroupRoleData> groupRoles, final Collection<CalendarData> calendarsData,
|
final Collection<ClientData> activeClientMembers, final Collection<GroupRoleData> groupRoles, final Collection<CalendarData> calendarsData,
|
||||||
final CalendarData collectionMeetingCalendar) {
|
final CalendarData collectionMeetingCalendar) {
|
||||||
return new GroupGeneralData(grouping.id, grouping.name, grouping.externalId, grouping.status, grouping.activationDate,
|
return new GroupGeneralData(grouping.id, grouping.accountNo, grouping.name, grouping.externalId, grouping.status, grouping.activationDate,
|
||||||
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
||||||
grouping.hierarchy, membersOfGroup, activeClientMembers, grouping.centerOptions, grouping.officeOptions, grouping.staffOptions,
|
grouping.hierarchy, membersOfGroup, activeClientMembers, grouping.centerOptions, grouping.officeOptions, grouping.staffOptions,
|
||||||
grouping.clientOptions, groupRoles, grouping.availableRoles, grouping.selectedRole, calendarsData,
|
grouping.clientOptions, groupRoles, grouping.availableRoles, grouping.selectedRole, calendarsData,
|
||||||
collectionMeetingCalendar, grouping.closureReasons, grouping.timeline);
|
collectionMeetingCalendar, grouping.closureReasons, grouping.timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GroupGeneralData instance(final Long id, final String name, final String externalId, final EnumOptionData status,
|
public static GroupGeneralData instance(final Long id, final String accountNo, final String name, final String externalId, final EnumOptionData status,
|
||||||
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
|
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
|
||||||
final Long staffId, final String staffName, final String hierarchy, final GroupTimelineData timeline) {
|
final Long staffId, final String staffName, final String hierarchy, final GroupTimelineData timeline) {
|
||||||
|
|
||||||
@@ -113,12 +114,12 @@ public class GroupGeneralData {
|
|||||||
final CalendarData collectionMeetingCalendar = null;
|
final CalendarData collectionMeetingCalendar = null;
|
||||||
final Collection<CodeValueData> closureReasons = null;
|
final Collection<CodeValueData> closureReasons = null;
|
||||||
|
|
||||||
return new GroupGeneralData(id, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
return new GroupGeneralData(id, accountNo, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
||||||
staffName, hierarchy, clientMembers, activeClientMembers, centerOptions, officeOptions, staffOptions,
|
staffName, hierarchy, clientMembers, activeClientMembers, centerOptions, officeOptions, staffOptions,
|
||||||
clientOptions, groupRoles, availableRoles, role, calendarsData, collectionMeetingCalendar, closureReasons, timeline);
|
clientOptions, groupRoles, availableRoles, role, calendarsData, collectionMeetingCalendar, closureReasons, timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GroupGeneralData(final Long id, final String name, final String externalId, final EnumOptionData status,
|
private GroupGeneralData(final Long id, final String accountNo, final String name, final String externalId, final EnumOptionData status,
|
||||||
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
|
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
|
||||||
final Long staffId, final String staffName, final String hierarchy, final Collection<ClientData> clientMembers,
|
final Long staffId, final String staffName, final String hierarchy, final Collection<ClientData> clientMembers,
|
||||||
final Collection<ClientData> activeClientMembers, final Collection<CenterData> centerOptions,
|
final Collection<ClientData> activeClientMembers, final Collection<CenterData> centerOptions,
|
||||||
@@ -128,6 +129,7 @@ public class GroupGeneralData {
|
|||||||
final Collection<CalendarData> calendarsData, final CalendarData collectionMeetingCalendar,
|
final Collection<CalendarData> calendarsData, final CalendarData collectionMeetingCalendar,
|
||||||
final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline) {
|
final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.accountNo = accountNo;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
@@ -171,6 +173,10 @@ public class GroupGeneralData {
|
|||||||
public Long getId() {
|
public Long getId() {
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getAccountNo(){
|
||||||
|
return this.accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return this.name;
|
return this.name;
|
||||||
@@ -193,7 +199,7 @@ public class GroupGeneralData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static GroupGeneralData updateSelectedRole(final GroupGeneralData grouping, final GroupRoleData selectedRole) {
|
public static GroupGeneralData updateSelectedRole(final GroupGeneralData grouping, final GroupRoleData selectedRole) {
|
||||||
return new GroupGeneralData(grouping.id, grouping.name, grouping.externalId, grouping.status, grouping.activationDate,
|
return new GroupGeneralData(grouping.id, grouping.accountNo, grouping.name, grouping.externalId, grouping.status, grouping.activationDate,
|
||||||
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
grouping.officeId, grouping.officeName, grouping.centerId, grouping.centerName, grouping.staffId, grouping.staffName,
|
||||||
grouping.hierarchy, grouping.clientMembers, grouping.activeClientMembers, grouping.centerOptions,
|
grouping.hierarchy, grouping.clientMembers, grouping.activeClientMembers, grouping.centerOptions,
|
||||||
grouping.officeOptions, grouping.staffOptions, grouping.clientOptions, grouping.groupRoles, grouping.availableRoles,
|
grouping.officeOptions, grouping.staffOptions, grouping.clientOptions, grouping.groupRoles, grouping.availableRoles,
|
||||||
@@ -202,6 +208,7 @@ public class GroupGeneralData {
|
|||||||
|
|
||||||
public static GroupGeneralData withClosureReasons(final Collection<CodeValueData> closureReasons) {
|
public static GroupGeneralData withClosureReasons(final Collection<CodeValueData> closureReasons) {
|
||||||
final Long id = null;
|
final Long id = null;
|
||||||
|
final String accountNo = null;
|
||||||
final String name = null;
|
final String name = null;
|
||||||
final String externalId = null;
|
final String externalId = null;
|
||||||
final EnumOptionData status = null;
|
final EnumOptionData status = null;
|
||||||
@@ -225,7 +232,7 @@ public class GroupGeneralData {
|
|||||||
final Collection<CalendarData> calendarsData = null;
|
final Collection<CalendarData> calendarsData = null;
|
||||||
final CalendarData collectionMeetingCalendar = null;
|
final CalendarData collectionMeetingCalendar = null;
|
||||||
|
|
||||||
return new GroupGeneralData(id, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
return new GroupGeneralData(id, accountNo, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
||||||
staffName, hierarchy, clientMembers, activeClientMembers, centerOptions, officeOptions, staffOptions, clientOptions, groupRoles,
|
staffName, hierarchy, clientMembers, activeClientMembers, centerOptions, officeOptions, staffOptions, clientOptions, groupRoles,
|
||||||
availableRoles, role, calendarsData, collectionMeetingCalendar, closureReasons, null);
|
availableRoles, role, calendarsData, collectionMeetingCalendar, closureReasons, null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import javax.persistence.OneToMany;
|
|||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
|
||||||
import org.apache.commons.lang.ObjectUtils;
|
import org.apache.commons.lang.ObjectUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -36,6 +37,7 @@ import org.mifosplatform.infrastructure.core.data.ApiParameterError;
|
|||||||
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
import org.mifosplatform.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
||||||
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
import org.mifosplatform.infrastructure.core.service.DateUtils;
|
||||||
|
import org.mifosplatform.infrastructure.security.service.RandomPasswordGenerator;
|
||||||
import org.mifosplatform.organisation.office.domain.Office;
|
import org.mifosplatform.organisation.office.domain.Office;
|
||||||
import org.mifosplatform.organisation.staff.domain.Staff;
|
import org.mifosplatform.organisation.staff.domain.Staff;
|
||||||
import org.mifosplatform.portfolio.client.domain.Client;
|
import org.mifosplatform.portfolio.client.domain.Client;
|
||||||
@@ -121,6 +123,12 @@ public final class Group extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "center", orphanRemoval = true)
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "center", orphanRemoval = true)
|
||||||
private Set<StaffAssignmentHistory> staffHistory;
|
private Set<StaffAssignmentHistory> staffHistory;
|
||||||
|
|
||||||
|
@Column(name = "account_no", length = 20, unique = true, nullable = false)
|
||||||
|
private String accountNumber;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private boolean accountNumberRequiresAutoGeneration = false;
|
||||||
|
|
||||||
// JPA default constructor for entity
|
// JPA default constructor for entity
|
||||||
protected Group() {
|
protected Group() {
|
||||||
@@ -131,7 +139,8 @@ public final class Group extends AbstractPersistable<Long> {
|
|||||||
|
|
||||||
public static Group newGroup(final Office office, final Staff staff, final Group parent, final GroupLevel groupLevel,
|
public static Group newGroup(final Office office, final Staff staff, final Group parent, final GroupLevel groupLevel,
|
||||||
final String name, final String externalId, final boolean active, final LocalDate activationDate,
|
final String name, final String externalId, final boolean active, final LocalDate activationDate,
|
||||||
final Set<Client> clientMembers, final Set<Group> groupMembers, final LocalDate submittedOnDate, final AppUser currentUser) {
|
final Set<Client> clientMembers, final Set<Group> groupMembers, final LocalDate submittedOnDate, final AppUser currentUser,
|
||||||
|
final String accountNo) {
|
||||||
|
|
||||||
// By default new group is created in PENDING status, unless explicitly
|
// By default new group is created in PENDING status, unless explicitly
|
||||||
// status is set to active
|
// status is set to active
|
||||||
@@ -141,14 +150,14 @@ public final class Group extends AbstractPersistable<Long> {
|
|||||||
status = GroupingTypeStatus.ACTIVE;
|
status = GroupingTypeStatus.ACTIVE;
|
||||||
groupActivationDate = activationDate;
|
groupActivationDate = activationDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Group(office, staff, parent, groupLevel, name, externalId, status, groupActivationDate, clientMembers, groupMembers,
|
return new Group(office, staff, parent, groupLevel, name, externalId, status, groupActivationDate, clientMembers, groupMembers,
|
||||||
submittedOnDate, currentUser);
|
submittedOnDate, currentUser, accountNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Group(final Office office, final Staff staff, final Group parent, final GroupLevel groupLevel, final String name,
|
private Group(final Office office, final Staff staff, final Group parent, final GroupLevel groupLevel, final String name,
|
||||||
final String externalId, final GroupingTypeStatus status, final LocalDate activationDate, final Set<Client> clientMembers,
|
final String externalId, final GroupingTypeStatus status, final LocalDate activationDate, final Set<Client> clientMembers,
|
||||||
final Set<Group> groupMembers, final LocalDate submittedOnDate, final AppUser currentUser) {
|
final Set<Group> groupMembers, final LocalDate submittedOnDate, final AppUser currentUser, final String accountNo) {
|
||||||
|
|
||||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||||
|
|
||||||
@@ -160,6 +169,13 @@ public final class Group extends AbstractPersistable<Long> {
|
|||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
this.parent.addChild(this);
|
this.parent.addChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(accountNo)) {
|
||||||
|
this.accountNumber = new RandomPasswordGenerator(19).generate();
|
||||||
|
this.accountNumberRequiresAutoGeneration = true;
|
||||||
|
} else {
|
||||||
|
this.accountNumber = accountNo;
|
||||||
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(name)) {
|
if (StringUtils.isNotBlank(name)) {
|
||||||
this.name = name.trim();
|
this.name = name.trim();
|
||||||
@@ -303,6 +319,12 @@ public final class Group extends AbstractPersistable<Long> {
|
|||||||
final LocalDate newValue = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
|
final LocalDate newValue = command.localDateValueOfParameterNamed(GroupingTypesApiConstants.activationDateParamName);
|
||||||
this.activationDate = newValue.toDate();
|
this.activationDate = newValue.toDate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (command.isChangeInStringParameterNamed(GroupingTypesApiConstants.accountNoParamName, this.accountNumber)) {
|
||||||
|
final String newValue = command.stringValueOfParameterNamed(GroupingTypesApiConstants.accountNoParamName);
|
||||||
|
actualChanges.put(GroupingTypesApiConstants.accountNoParamName, newValue);
|
||||||
|
this.accountNumber = StringUtils.defaultIfEmpty(newValue, null);
|
||||||
|
}
|
||||||
|
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
}
|
}
|
||||||
@@ -692,4 +714,17 @@ public final class Group extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
return latestRecordWithNoEndDate;
|
return latestRecordWithNoEndDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAccountNumberRequiresAutoGeneration() {
|
||||||
|
return this.accountNumberRequiresAutoGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAccountNumberRequiresAutoGeneration(final boolean accountNumberRequiresAutoGeneration) {
|
||||||
|
this.accountNumberRequiresAutoGeneration = accountNumberRequiresAutoGeneration;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAccountNo(final String accountIdentifier) {
|
||||||
|
this.accountNumber = accountIdentifier;
|
||||||
|
this.accountNumberRequiresAutoGeneration = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+3
-2
@@ -25,7 +25,7 @@ public final class AllGroupTypesDataMapper implements RowMapper<GroupGeneralData
|
|||||||
|
|
||||||
public AllGroupTypesDataMapper() {
|
public AllGroupTypesDataMapper() {
|
||||||
final StringBuilder sqlBuilder = new StringBuilder(400);
|
final StringBuilder sqlBuilder = new StringBuilder(400);
|
||||||
sqlBuilder.append("g.id as id, g.external_id as externalId, g.display_name as name, ");
|
sqlBuilder.append("g.id as id, g.account_no as accountNumber, g.external_id as externalId, g.display_name as name, ");
|
||||||
sqlBuilder.append("g.office_id as officeId, o.name as officeName, ");
|
sqlBuilder.append("g.office_id as officeId, o.name as officeName, ");
|
||||||
sqlBuilder.append("g.parent_id as centerId, pg.display_name as centerName, ");
|
sqlBuilder.append("g.parent_id as centerId, pg.display_name as centerName, ");
|
||||||
sqlBuilder.append("g.staff_id as staffId, s.display_name as staffName, ");
|
sqlBuilder.append("g.staff_id as staffId, s.display_name as staffName, ");
|
||||||
@@ -65,6 +65,7 @@ public final class AllGroupTypesDataMapper implements RowMapper<GroupGeneralData
|
|||||||
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
final Long id = rs.getLong("id");
|
||||||
|
final String accountNo = rs.getString("accountNumber");
|
||||||
final String name = rs.getString("name");
|
final String name = rs.getString("name");
|
||||||
final String externalId = rs.getString("externalId");
|
final String externalId = rs.getString("externalId");
|
||||||
|
|
||||||
@@ -98,7 +99,7 @@ public final class AllGroupTypesDataMapper implements RowMapper<GroupGeneralData
|
|||||||
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByUsername, closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return GroupGeneralData.instance(id, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
return GroupGeneralData.instance(id, accountNo, name, externalId, status, activationDate, officeId, officeName, centerId, centerName, staffId,
|
||||||
staffName, hierarchy, timeline);
|
staffName, hierarchy, timeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-7
@@ -136,7 +136,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
return extraCriteria.toString();
|
return extraCriteria.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String sqlQuery = "g.id as id, g.external_id as externalId, g.display_name as name, "
|
private static final String sqlQuery = "g.id as id, g.account_no as accountNo, g.external_id as externalId, g.display_name as name, "
|
||||||
+ "g.office_id as officeId, o.name as officeName, " //
|
+ "g.office_id as officeId, o.name as officeName, " //
|
||||||
+ "g.staff_id as staffId, s.display_name as staffName, " //
|
+ "g.staff_id as staffId, s.display_name as staffName, " //
|
||||||
+ "g.status_enum as statusEnum, g.activation_date as activationDate, " //
|
+ "g.status_enum as statusEnum, g.activation_date as activationDate, " //
|
||||||
@@ -168,6 +168,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
public CenterData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
public CenterData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
final Long id = rs.getLong("id");
|
||||||
|
final String accountNo = rs.getString("accountNo");
|
||||||
final String name = rs.getString("name");
|
final String name = rs.getString("name");
|
||||||
final Integer statusEnum = JdbcSupport.getInteger(rs, "statusEnum");
|
final Integer statusEnum = JdbcSupport.getInteger(rs, "statusEnum");
|
||||||
final EnumOptionData status = GroupingTypeEnumerations.status(statusEnum);
|
final EnumOptionData status = GroupingTypeEnumerations.status(statusEnum);
|
||||||
@@ -197,7 +198,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByUsername, closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return CenterData.instance(id, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
return CenterData.instance(id, accountNo, name, externalId, status, activationDate, officeId, officeName, staffId, staffName, hierarchy,
|
||||||
timeline, null);
|
timeline, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -208,7 +209,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
|
|
||||||
public CenterCalendarDataMapper() {
|
public CenterCalendarDataMapper() {
|
||||||
|
|
||||||
schemaSql = " select g.id as id, g.display_name as name, g.office_id as officeId, g.staff_id as staffId, s.display_name as staffName, g.external_id as externalId, "
|
schemaSql = " select g.id as id, g.accountNo as accountNo, g.display_name as name, g.office_id as officeId, g.staff_id as staffId, s.display_name as staffName, g.external_id as externalId, "
|
||||||
+ " g.status_enum as statusEnum, g.activation_date as activationDate, g.hierarchy as hierarchy, "
|
+ " g.status_enum as statusEnum, g.activation_date as activationDate, g.hierarchy as hierarchy, "
|
||||||
+ " c.id as calendarId, ci.id as calendarInstanceId, ci.entity_id as entityId, "
|
+ " c.id as calendarId, ci.id as calendarInstanceId, ci.entity_id as entityId, "
|
||||||
+ " ci.entity_type_enum as entityTypeId, c.title as title, c.description as description, "
|
+ " ci.entity_type_enum as entityTypeId, c.title as title, c.description as description, "
|
||||||
@@ -225,6 +226,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
public CenterData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
public CenterData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
final Long id = rs.getLong("id");
|
||||||
|
final String accountNo = rs.getString("accountNo");
|
||||||
final String name = rs.getString("name");
|
final String name = rs.getString("name");
|
||||||
final Integer statusEnum = JdbcSupport.getInteger(rs, "statusEnum");
|
final Integer statusEnum = JdbcSupport.getInteger(rs, "statusEnum");
|
||||||
final EnumOptionData status = GroupingTypeEnumerations.status(statusEnum);
|
final EnumOptionData status = GroupingTypeEnumerations.status(statusEnum);
|
||||||
@@ -250,7 +252,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
CalendarData calendarData = CalendarData.instance(calendarId, calendarInstanceId, entityId, entityType, title, description,
|
CalendarData calendarData = CalendarData.instance(calendarId, calendarInstanceId, entityId, entityType, title, description,
|
||||||
location, startDate, endDate, null, null, false, recurrence, null, null, null, null, null, null, null, null, null,
|
location, startDate, endDate, null, null, false, recurrence, null, null, null, null, null, null, null, null, null,
|
||||||
null, null, null, null);
|
null, null, null, null);
|
||||||
return CenterData.instance(id, name, externalId, status, activationDate, officeId, null, staffId, staffName, hierarchy, null,
|
return CenterData.instance(id, accountNo, name, externalId, status, activationDate, officeId, null, staffId, staffName, hierarchy, null,
|
||||||
calendarData);
|
calendarData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -272,6 +274,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
final Long id = rs.getLong("id");
|
||||||
|
final String accountNo = rs.getString("accountNo");
|
||||||
final String name = rs.getString("name");
|
final String name = rs.getString("name");
|
||||||
final String externalId = rs.getString("externalId");
|
final String externalId = rs.getString("externalId");
|
||||||
|
|
||||||
@@ -303,7 +306,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
submittedByLastname, activationDate, activatedByUsername, activatedByFirstname, activatedByLastname, closedOnDate,
|
||||||
closedByUsername, closedByFirstname, closedByLastname);
|
closedByUsername, closedByFirstname, closedByLastname);
|
||||||
|
|
||||||
return GroupGeneralData.instance(id, name, externalId, status, activationDate, officeId, officeName, null, null, staffId,
|
return GroupGeneralData.instance(id, accountNo, name, externalId, status, activationDate, officeId, officeName, null, null, staffId,
|
||||||
staffName, hierarchy, timeline);
|
staffName, hierarchy, timeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -409,11 +412,12 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
staffOptions = null;
|
staffOptions = null;
|
||||||
}
|
}
|
||||||
final Collection<GroupGeneralData> groupMembersOptions = null;
|
final Collection<GroupGeneralData> groupMembersOptions = null;
|
||||||
|
final String accountNo = null;
|
||||||
|
|
||||||
// final boolean clientPendingApprovalAllowed =
|
// final boolean clientPendingApprovalAllowed =
|
||||||
// this.configurationDomainService.isClientPendingApprovalAllowedEnabled();
|
// this.configurationDomainService.isClientPendingApprovalAllowedEnabled();
|
||||||
|
|
||||||
return CenterData.template(officeIdDefaulted, new LocalDate(), officeOptions, staffOptions, groupMembersOptions);
|
return CenterData.template(officeIdDefaulted, accountNo, new LocalDate(), officeOptions, staffOptions, groupMembersOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long defaultToUsersOfficeIfNull(final Long officeId) {
|
private Long defaultToUsersOfficeIfNull(final Long officeId) {
|
||||||
@@ -469,7 +473,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
clientOptions = null;
|
clientOptions = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GroupGeneralData.template(centerOfficeId, center.getId(), center.getName(), staffId, staffName, centerOptions,
|
return GroupGeneralData.template(centerOfficeId, center.getId(), center.getAccountNo(), center.getName(), staffId, staffName, centerOptions,
|
||||||
officeOptions, staffOptions, clientOptions, null);
|
officeOptions, staffOptions, clientOptions, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,6 +517,8 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService
|
|||||||
flag = false;
|
flag = false;
|
||||||
if (staffCenterData.getStaffId().equals(centerData.staffId())) {
|
if (staffCenterData.getStaffId().equals(centerData.staffId())) {
|
||||||
staffCenterData.getMeetingFallCenters().add(centerData);
|
staffCenterData.getMeetingFallCenters().add(centerData);
|
||||||
|
|
||||||
|
|
||||||
flag = true;
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-3
@@ -104,12 +104,13 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
|
|||||||
.retrieveCodeValuesByCode(GroupingTypesApiConstants.GROUP_ROLE_NAME);
|
.retrieveCodeValuesByCode(GroupingTypesApiConstants.GROUP_ROLE_NAME);
|
||||||
|
|
||||||
final Long centerId = null;
|
final Long centerId = null;
|
||||||
|
final String accountNo = null;
|
||||||
final String centerName = null;
|
final String centerName = null;
|
||||||
final Long staffId = null;
|
final Long staffId = null;
|
||||||
final String staffName = null;
|
final String staffName = null;
|
||||||
final Collection<ClientData> clientOptions = null;
|
final Collection<ClientData> clientOptions = null;
|
||||||
|
|
||||||
return GroupGeneralData.template(defaultOfficeId, centerId, centerName, staffId, staffName, centerOptions, officeOptions,
|
return GroupGeneralData.template(defaultOfficeId, centerId, accountNo, centerName, staffId, staffName, centerOptions, officeOptions,
|
||||||
staffOptions, clientOptions, availableRoles);
|
staffOptions, clientOptions, availableRoles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,14 +265,15 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService {
|
|||||||
private static final class GroupLookupDataMapper implements RowMapper<GroupGeneralData> {
|
private static final class GroupLookupDataMapper implements RowMapper<GroupGeneralData> {
|
||||||
|
|
||||||
public final String schema() {
|
public final String schema() {
|
||||||
return "g.id as id, g.display_name as displayName from m_group g where g.level_id = 2 ";
|
return "g.id as id, g.account_no as accountNo, g.display_name as displayName from m_group g where g.level_id = 2 ";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
public GroupGeneralData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
final Long id = JdbcSupport.getLong(rs, "id");
|
final Long id = JdbcSupport.getLong(rs, "id");
|
||||||
|
final String accountNo = rs.getString("accountNo");
|
||||||
final String displayName = rs.getString("displayName");
|
final String displayName = rs.getString("displayName");
|
||||||
return GroupGeneralData.lookup(id, displayName);
|
return GroupGeneralData.lookup(id, accountNo, displayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+29
-2
@@ -17,6 +17,9 @@ import org.joda.time.LocalDate;
|
|||||||
import org.mifosplatform.commands.domain.CommandWrapper;
|
import org.mifosplatform.commands.domain.CommandWrapper;
|
||||||
import org.mifosplatform.commands.service.CommandProcessingService;
|
import org.mifosplatform.commands.service.CommandProcessingService;
|
||||||
import org.mifosplatform.commands.service.CommandWrapperBuilder;
|
import org.mifosplatform.commands.service.CommandWrapperBuilder;
|
||||||
|
import org.mifosplatform.infrastructure.accountnumberformat.domain.AccountNumberFormat;
|
||||||
|
import org.mifosplatform.infrastructure.accountnumberformat.domain.AccountNumberFormatRepositoryWrapper;
|
||||||
|
import org.mifosplatform.infrastructure.accountnumberformat.domain.EntityAccountType;
|
||||||
import org.mifosplatform.infrastructure.codes.domain.CodeValue;
|
import org.mifosplatform.infrastructure.codes.domain.CodeValue;
|
||||||
import org.mifosplatform.infrastructure.codes.domain.CodeValueRepositoryWrapper;
|
import org.mifosplatform.infrastructure.codes.domain.CodeValueRepositoryWrapper;
|
||||||
import org.mifosplatform.infrastructure.configuration.domain.ConfigurationDomainService;
|
import org.mifosplatform.infrastructure.configuration.domain.ConfigurationDomainService;
|
||||||
@@ -37,6 +40,7 @@ import org.mifosplatform.portfolio.calendar.domain.CalendarEntityType;
|
|||||||
import org.mifosplatform.portfolio.calendar.domain.CalendarInstance;
|
import org.mifosplatform.portfolio.calendar.domain.CalendarInstance;
|
||||||
import org.mifosplatform.portfolio.calendar.domain.CalendarInstanceRepository;
|
import org.mifosplatform.portfolio.calendar.domain.CalendarInstanceRepository;
|
||||||
import org.mifosplatform.portfolio.calendar.domain.CalendarType;
|
import org.mifosplatform.portfolio.calendar.domain.CalendarType;
|
||||||
|
import org.mifosplatform.portfolio.client.domain.AccountNumberGenerator;
|
||||||
import org.mifosplatform.portfolio.client.domain.Client;
|
import org.mifosplatform.portfolio.client.domain.Client;
|
||||||
import org.mifosplatform.portfolio.client.domain.ClientRepositoryWrapper;
|
import org.mifosplatform.portfolio.client.domain.ClientRepositoryWrapper;
|
||||||
import org.mifosplatform.portfolio.client.service.LoanStatusMapper;
|
import org.mifosplatform.portfolio.client.service.LoanStatusMapper;
|
||||||
@@ -91,6 +95,8 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
private final ConfigurationDomainService configurationDomainService;
|
private final ConfigurationDomainService configurationDomainService;
|
||||||
private final SavingsAccountRepository savingsAccountRepository;
|
private final SavingsAccountRepository savingsAccountRepository;
|
||||||
private final LoanRepositoryWrapper loanRepositoryWrapper;
|
private final LoanRepositoryWrapper loanRepositoryWrapper;
|
||||||
|
private final AccountNumberFormatRepositoryWrapper accountNumberFormatRepository;
|
||||||
|
private final AccountNumberGenerator accountNumberGenerator;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public GroupingTypesWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
|
public GroupingTypesWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
|
||||||
@@ -100,7 +106,8 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
final LoanRepository loanRepository, final SavingsAccountRepository savingsRepository,
|
final LoanRepository loanRepository, final SavingsAccountRepository savingsRepository,
|
||||||
final CodeValueRepositoryWrapper codeValueRepository, final CommandProcessingService commandProcessingService,
|
final CodeValueRepositoryWrapper codeValueRepository, final CommandProcessingService commandProcessingService,
|
||||||
final CalendarInstanceRepository calendarInstanceRepository, final ConfigurationDomainService configurationDomainService,
|
final CalendarInstanceRepository calendarInstanceRepository, final ConfigurationDomainService configurationDomainService,
|
||||||
final SavingsAccountRepository savingsAccountRepository, final LoanRepositoryWrapper loanRepositoryWrapper) {
|
final SavingsAccountRepository savingsAccountRepository, final LoanRepositoryWrapper loanRepositoryWrapper,
|
||||||
|
final AccountNumberFormatRepositoryWrapper accountNumberFormatRepository, final AccountNumberGenerator accountNumberGenerator) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.groupRepository = groupRepository;
|
this.groupRepository = groupRepository;
|
||||||
this.clientRepositoryWrapper = clientRepositoryWrapper;
|
this.clientRepositoryWrapper = clientRepositoryWrapper;
|
||||||
@@ -117,10 +124,13 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
this.configurationDomainService = configurationDomainService;
|
this.configurationDomainService = configurationDomainService;
|
||||||
this.savingsAccountRepository = savingsAccountRepository;
|
this.savingsAccountRepository = savingsAccountRepository;
|
||||||
this.loanRepositoryWrapper = loanRepositoryWrapper;
|
this.loanRepositoryWrapper = loanRepositoryWrapper;
|
||||||
|
this.accountNumberFormatRepository = accountNumberFormatRepository;
|
||||||
|
this.accountNumberGenerator = accountNumberGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private CommandProcessingResult createGroupingType(final JsonCommand command, final GroupTypes groupingType, final Long centerId) {
|
private CommandProcessingResult createGroupingType(final JsonCommand command, final GroupTypes groupingType, final Long centerId) {
|
||||||
try {
|
try {
|
||||||
|
final String accountNo = command.stringValueOfParameterNamed(GroupingTypesApiConstants.accountNoParamName);
|
||||||
final String name = command.stringValueOfParameterNamed(GroupingTypesApiConstants.nameParamName);
|
final String name = command.stringValueOfParameterNamed(GroupingTypesApiConstants.nameParamName);
|
||||||
final String externalId = command.stringValueOfParameterNamed(GroupingTypesApiConstants.externalIdParamName);
|
final String externalId = command.stringValueOfParameterNamed(GroupingTypesApiConstants.externalIdParamName);
|
||||||
|
|
||||||
@@ -163,7 +173,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Group newGroup = Group.newGroup(groupOffice, staff, parentGroup, groupLevel, name, externalId, active, activationDate,
|
final Group newGroup = Group.newGroup(groupOffice, staff, parentGroup, groupLevel, name, externalId, active, activationDate,
|
||||||
clientMembers, groupMembers, submittedOnDate, currentUser);
|
clientMembers, groupMembers, submittedOnDate, currentUser, accountNo);
|
||||||
|
|
||||||
boolean rollbackTransaction = false;
|
boolean rollbackTransaction = false;
|
||||||
if (newGroup.isActive()) {
|
if (newGroup.isActive()) {
|
||||||
@@ -194,6 +204,23 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group
|
|||||||
* groups if they exist
|
* groups if they exist
|
||||||
*/
|
*/
|
||||||
newGroup.generateHierarchy();
|
newGroup.generateHierarchy();
|
||||||
|
|
||||||
|
if (newGroup.isAccountNumberRequiresAutoGeneration()) {
|
||||||
|
EntityAccountType entityAccountType = null;
|
||||||
|
AccountNumberFormat accountNumberFormat = null;
|
||||||
|
if(newGroup.isCenter()){
|
||||||
|
entityAccountType = EntityAccountType.CENTER;
|
||||||
|
accountNumberFormat = this.accountNumberFormatRepository
|
||||||
|
.findByAccountType(entityAccountType);
|
||||||
|
newGroup.updateAccountNo(this.accountNumberGenerator.generateCenterAccountNumber(newGroup, accountNumberFormat));
|
||||||
|
}else {
|
||||||
|
entityAccountType = EntityAccountType.GROUP;
|
||||||
|
accountNumberFormat = this.accountNumberFormatRepository
|
||||||
|
.findByAccountType(entityAccountType);
|
||||||
|
newGroup.updateAccountNo(this.accountNumberGenerator.generateGroupAccountNumber(newGroup, accountNumberFormat));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
this.groupRepository.saveAndFlush(newGroup);
|
this.groupRepository.saveAndFlush(newGroup);
|
||||||
newGroup.captureStaffHistoryDuringCenterCreation(staff, activationDate);
|
newGroup.captureStaffHistoryDuringCenterCreation(staff, activationDate);
|
||||||
|
|||||||
+3
-2
@@ -544,7 +544,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
+ " lp.allow_multiple_disbursals as multiDisburseLoan,"
|
+ " lp.allow_multiple_disbursals as multiDisburseLoan,"
|
||||||
+ " lp.can_define_fixed_emi_amount as canDefineInstallmentAmount,"
|
+ " lp.can_define_fixed_emi_amount as canDefineInstallmentAmount,"
|
||||||
+ " c.id as clientId, c.display_name as clientName, c.office_id as clientOfficeId,"
|
+ " c.id as clientId, c.display_name as clientName, c.office_id as clientOfficeId,"
|
||||||
+ " g.id as groupId, g.display_name as groupName,"
|
+ " g.id as groupId, g.account_no as groupAccountNo, g.display_name as groupName,"
|
||||||
+ " g.office_id as groupOfficeId, g.staff_id As groupStaffId , g.parent_id as groupParentId, "
|
+ " g.office_id as groupOfficeId, g.staff_id As groupStaffId , g.parent_id as groupParentId, "
|
||||||
+ " g.hierarchy As groupHierarchy , g.external_id As groupExternalId, "
|
+ " g.hierarchy As groupHierarchy , g.external_id As groupExternalId, "
|
||||||
+ " g.status_enum as statusEnum, g.activation_date as activationDate, "
|
+ " g.status_enum as statusEnum, g.activation_date as activationDate, "
|
||||||
@@ -652,6 +652,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
|
|
||||||
final Long groupId = JdbcSupport.getLong(rs, "groupId");
|
final Long groupId = JdbcSupport.getLong(rs, "groupId");
|
||||||
final String groupName = rs.getString("groupName");
|
final String groupName = rs.getString("groupName");
|
||||||
|
final String groupAccountNo = rs.getString("groupAccountNo");
|
||||||
final String groupExternalId = rs.getString("groupExternalId");
|
final String groupExternalId = rs.getString("groupExternalId");
|
||||||
final Long groupOfficeId = JdbcSupport.getLong(rs, "groupOfficeId");
|
final Long groupOfficeId = JdbcSupport.getLong(rs, "groupOfficeId");
|
||||||
final Long groupStaffId = JdbcSupport.getLong(rs, "groupStaffId");
|
final Long groupStaffId = JdbcSupport.getLong(rs, "groupStaffId");
|
||||||
@@ -836,7 +837,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
|||||||
final Integer groupStatusEnum = JdbcSupport.getInteger(rs, "statusEnum");
|
final Integer groupStatusEnum = JdbcSupport.getInteger(rs, "statusEnum");
|
||||||
final EnumOptionData groupStatus = ClientEnumerations.status(groupStatusEnum);
|
final EnumOptionData groupStatus = ClientEnumerations.status(groupStatusEnum);
|
||||||
final LocalDate activationDate = JdbcSupport.getLocalDate(rs, "activationDate");
|
final LocalDate activationDate = JdbcSupport.getLocalDate(rs, "activationDate");
|
||||||
groupData = GroupGeneralData.instance(groupId, groupName, groupExternalId, groupStatus, activationDate, groupOfficeId,
|
groupData = GroupGeneralData.instance(groupId, groupAccountNo, groupName, groupExternalId, groupStatus, activationDate, groupOfficeId,
|
||||||
null, groupParentId, null, groupStaffId, null, groupHierarchy, null);
|
null, groupParentId, null, groupStaffId, null, groupHierarchy, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -114,13 +114,13 @@ public class SearchReadPlatformServiceImpl implements SearchReadPlatformService
|
|||||||
+ " from m_client_identifier ci join m_client c on ci.client_id=c.id join m_office o on o.id = c.office_id "
|
+ " from m_client_identifier ci join m_client c on ci.client_id=c.id join m_office o on o.id = c.office_id "
|
||||||
+ " where o.hierarchy like :hierarchy and (ci.document_key like :partialSearch and ci.document_key not like :search))";
|
+ " where o.hierarchy like :hierarchy and (ci.document_key like :partialSearch and ci.document_key not like :search))";
|
||||||
|
|
||||||
final String groupExactMatchSql = " (select IF(g.level_id=1,'CENTER','GROUP') as entityType, g.id as entityId, g.display_name as entityName, g.external_id as entityExternalId, NULL as entityAccountNo "
|
final String groupExactMatchSql = " (select IF(g.level_id=1,'CENTER','GROUP') as entityType, g.id as entityId, g.display_name as entityName, g.external_id as entityExternalId, g.account_no as entityAccountNo "
|
||||||
+ " , g.office_id as parentId, o.name as parentName, null as entityMobileNo, g.status_enum as entityStatusEnum "
|
+ " , g.office_id as parentId, o.name as parentName, null as entityMobileNo, g.status_enum as entityStatusEnum "
|
||||||
+ " from m_group g join m_office o on o.id = g.office_id where o.hierarchy like :hierarchy and (g.display_name like :search or g.external_id like :search or g.id like :search )) ";
|
+ " from m_group g join m_office o on o.id = g.office_id where o.hierarchy like :hierarchy and (g.account_no like :search or g.display_name like :search or g.external_id like :search or g.id like :search )) ";
|
||||||
|
|
||||||
final String groupMatchSql = " (select IF(g.level_id=1,'CENTER','GROUP') as entityType, g.id as entityId, g.display_name as entityName, g.external_id as entityExternalId, NULL as entityAccountNo "
|
final String groupMatchSql = " (select IF(g.level_id=1,'CENTER','GROUP') as entityType, g.id as entityId, g.display_name as entityName, g.external_id as entityExternalId, g.account_no as entityAccountNo "
|
||||||
+ " , g.office_id as parentId, o.name as parentName, null as entityMobileNo, g.status_enum as entityStatusEnum "
|
+ " , g.office_id as parentId, o.name as parentName, null as entityMobileNo, g.status_enum as entityStatusEnum "
|
||||||
+ " from m_group g join m_office o on o.id = g.office_id where o.hierarchy like :hierarchy and (g.display_name like :partialSearch and g.display_name not like :search) or(g.external_id like :partialSearch and g.external_id not like :search) or (g.id like :partialSearch and g.id not like :search)) ";
|
+ " from m_group g join m_office o on o.id = g.office_id where o.hierarchy like :hierarchy and (g.account_no like :partialSearch and g.account_no not like :search) or (g.display_name like :partialSearch and g.display_name not like :search) or(g.external_id like :partialSearch and g.external_id not like :search) or (g.id like :partialSearch and g.id not like :search)) ";
|
||||||
|
|
||||||
final StringBuffer sql = new StringBuffer();
|
final StringBuffer sql = new StringBuffer();
|
||||||
|
|
||||||
|
|||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE m_group ADD COLUMN `account_no` VARCHAR(20) NOT NULL;
|
||||||
|
UPDATE m_group set account_no = lpad(id,9,0);
|
||||||
Reference in New Issue
Block a user