MIFOSX-342: bring in work from yanna with some modifications.
This commit is contained in:
@@ -90,7 +90,7 @@
|
||||
<body>
|
||||
<div id="page-wrapper">
|
||||
<div id="flybar">
|
||||
<div id="nav-logo">1.0.1.RELEASE API</div>
|
||||
<div id="nav-logo">1.1.0.RELEASE API</div>
|
||||
<div class="flybar-nav">
|
||||
<h2 class="flybar-button">Overview</h2>
|
||||
<div class="flybar-menu-overview">
|
||||
|
||||
+64
-5
@@ -24,8 +24,13 @@ import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSourc
|
||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.mifosplatform.organisation.office.data.OfficeData;
|
||||
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.mifosplatform.organisation.staff.data.StaffData;
|
||||
import org.mifosplatform.organisation.staff.service.StaffReadPlatformService;
|
||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
||||
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
|
||||
import org.mifosplatform.portfolio.loanproduct.data.LoanProductData;
|
||||
import org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations;
|
||||
import org.mifosplatform.portfolio.loanproduct.service.LoanProductReadPlatformService;
|
||||
import org.mifosplatform.useradministration.data.AppUserData;
|
||||
import org.mifosplatform.useradministration.domain.AppUser;
|
||||
import org.mifosplatform.useradministration.service.AppUserReadPlatformService;
|
||||
@@ -51,17 +56,22 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
private final AppUserReadPlatformService appUserReadPlatformService;
|
||||
private final OfficeReadPlatformService officeReadPlatformService;
|
||||
private final ClientReadPlatformService clientReadPlatformService;
|
||||
private final LoanProductReadPlatformService loanProductReadPlatformService;
|
||||
private final StaffReadPlatformService staffReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public AuditReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource,
|
||||
final FromJsonHelper fromApiJsonHelper, final AppUserReadPlatformService appUserReadPlatformService,
|
||||
final OfficeReadPlatformService officeReadPlatformService, final ClientReadPlatformService clientReadPlatformService) {
|
||||
final OfficeReadPlatformService officeReadPlatformService, final ClientReadPlatformService clientReadPlatformService,
|
||||
final LoanProductReadPlatformService loanProductReadPlatformService, final StaffReadPlatformService staffReadPlatformService) {
|
||||
this.context = context;
|
||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
this.appUserReadPlatformService = appUserReadPlatformService;
|
||||
this.officeReadPlatformService = officeReadPlatformService;
|
||||
this.clientReadPlatformService = clientReadPlatformService;
|
||||
this.loanProductReadPlatformService = loanProductReadPlatformService;
|
||||
this.staffReadPlatformService = staffReadPlatformService;
|
||||
}
|
||||
|
||||
private static final class AuditMapper implements RowMapper<AuditData> {
|
||||
@@ -209,8 +219,10 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
if (commandAsJsonMap.containsKey("officeId")) {
|
||||
commandAsJsonMap.remove("officeId");
|
||||
|
||||
final Long officeId = auditObject.get("officeId").getAsLong();
|
||||
if (officeId != null) {
|
||||
Long officeId = null;
|
||||
String officeIdStr = auditObject.get("officeId").getAsString();
|
||||
if (StringUtils.isNotBlank(officeIdStr)) {
|
||||
officeId = Long.valueOf(officeIdStr);
|
||||
OfficeData office = this.officeReadPlatformService.retrieveOffice(officeId);
|
||||
commandAsJsonMap.put("officeName", office.name());
|
||||
} else {
|
||||
@@ -221,8 +233,10 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
if (commandAsJsonMap.containsKey("clientId")) {
|
||||
commandAsJsonMap.remove("clientId");
|
||||
|
||||
final Long clientId = auditObject.get("officeId").getAsLong();
|
||||
if (clientId != null) {
|
||||
Long clientId = null;
|
||||
String clientIdStr = auditObject.get("clientId").getAsString();
|
||||
if (StringUtils.isNotBlank(clientIdStr)) {
|
||||
clientId = Long.valueOf(clientIdStr);
|
||||
ClientData client = this.clientReadPlatformService.retrieveOne(clientId);
|
||||
commandAsJsonMap.put("clientName", client.displayName());
|
||||
} else {
|
||||
@@ -230,6 +244,51 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService {
|
||||
}
|
||||
}
|
||||
|
||||
if (commandAsJsonMap.containsKey("productId")) {
|
||||
commandAsJsonMap.remove("productId");
|
||||
|
||||
Long productId = null;
|
||||
String productIdStr = auditObject.get("productId").getAsString();
|
||||
if (StringUtils.isNotBlank(productIdStr)) {
|
||||
productId = Long.valueOf(productIdStr);
|
||||
LoanProductData loanProduct = this.loanProductReadPlatformService.retrieveLoanProduct(productId);
|
||||
commandAsJsonMap.put("productName", loanProduct.getName());
|
||||
} else {
|
||||
commandAsJsonMap.put("productName", "");
|
||||
}
|
||||
}
|
||||
|
||||
if (commandAsJsonMap.containsKey("loanOfficerId")) {
|
||||
commandAsJsonMap.remove("loanOfficerId");
|
||||
|
||||
Long loanOfficerId = null;
|
||||
String loanOfficerIdStr = auditObject.get("loanOfficerId").getAsString();
|
||||
if (StringUtils.isNotBlank(loanOfficerIdStr)) {
|
||||
loanOfficerId = Long.valueOf(loanOfficerIdStr);
|
||||
StaffData officer = this.staffReadPlatformService.retrieveStaff(loanOfficerId);
|
||||
commandAsJsonMap.put("loanOfficerName", officer.getDisplayName());
|
||||
} else {
|
||||
commandAsJsonMap.put("loanOfficerName", "");
|
||||
}
|
||||
}
|
||||
|
||||
final String[] enumTypes = { "loanTermFrequencyType", "repaymentFrequencyType", "amortizationType", "interestType",
|
||||
"interestCalculationPeriodType", "interestRateFrequencyType" };
|
||||
|
||||
for (String typeName : enumTypes) {
|
||||
if (commandAsJsonMap.containsKey(typeName)) {
|
||||
commandAsJsonMap.remove(typeName);
|
||||
|
||||
final Integer enumTypeId = auditObject.get(typeName).getAsInt();
|
||||
if (enumTypeId != null) {
|
||||
final String code = LoanEnumerations.loanEnumueration(typeName, enumTypeId).getCode();
|
||||
if (code != null) {
|
||||
commandAsJsonMap.put(typeName, code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final String newAuditAsJson = this.fromApiJsonHelper.toJson(commandAsJsonMap);
|
||||
auditResult.setCommandAsJson(newAuditAsJson);
|
||||
|
||||
|
||||
+4
@@ -26,4 +26,8 @@ public class EnumOptionData {
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
}
|
||||
+36
-2
@@ -23,6 +23,40 @@ import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
|
||||
|
||||
public class LoanEnumerations {
|
||||
|
||||
public static final String LOAN_TERM_FREQUENCY_TYPE = "loanTermFrequencyType";
|
||||
public static final String TERM_FREQUENCY_TYPE = "termFrequencyType";
|
||||
public static final String REPAYMENT_FREQUENCY_TYPE = "repaymentFrequencyType";
|
||||
public static final String INTEREST_RATE_FREQUENCY_TYPE = "interestRateFrequencyType";
|
||||
public static final String AMORTIZATION_TYPE = "amortizationType";
|
||||
public static final String INTEREST_TYPE = "interestType";
|
||||
public static final String INTEREST_CALCULATION_PERIOD_TYPE = "interestCalculationPeriodType";
|
||||
public static final String PAYMENT_TYPE = "paymentType";
|
||||
public static final String ACCOUNTING_RULE_TYPE = "accountingRuleType";
|
||||
public static final String LOAN_TYPE = "loanType";
|
||||
|
||||
public static EnumOptionData loanEnumueration(final String typeName, final int id) {
|
||||
if (typeName.equals(LOAN_TERM_FREQUENCY_TYPE)) {
|
||||
return loanTermFrequencyType(id);
|
||||
} else if (typeName.equals(TERM_FREQUENCY_TYPE)) {
|
||||
return termFrequencyType(id);
|
||||
} else if (typeName.equals(REPAYMENT_FREQUENCY_TYPE)) {
|
||||
return repaymentFrequencyType(id);
|
||||
} else if (typeName.equals(INTEREST_RATE_FREQUENCY_TYPE)) {
|
||||
return interestRateFrequencyType(id);
|
||||
} else if (typeName.equals(AMORTIZATION_TYPE)) {
|
||||
return amortizationType(id);
|
||||
} else if (typeName.equals(INTEREST_TYPE)) {
|
||||
return interestType(id);
|
||||
} else if (typeName.equals(INTEREST_CALCULATION_PERIOD_TYPE)) {
|
||||
return interestCalculationPeriodType(id);
|
||||
} else if (typeName.equals(PAYMENT_TYPE)) {
|
||||
return paymentType(id);
|
||||
} else if (typeName.equals(ACCOUNTING_RULE_TYPE)) {
|
||||
return accountingRuleType(id);
|
||||
} else if (typeName.equals(LOAN_TYPE)) { return loanType(id); }
|
||||
return null;
|
||||
}
|
||||
|
||||
public static EnumOptionData loanTermFrequencyType(final int id) {
|
||||
return loanTermFrequencyType(PeriodFrequencyType.fromInt(id));
|
||||
}
|
||||
@@ -338,11 +372,11 @@ public class LoanEnumerations {
|
||||
EnumOptionData optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), type.toString());
|
||||
return optionData;
|
||||
}
|
||||
|
||||
|
||||
public static EnumOptionData loanType(final Integer loanTypeId) {
|
||||
return loanType(LoanType.fromInt(loanTypeId));
|
||||
}
|
||||
|
||||
|
||||
public static EnumOptionData loanType(final String name) {
|
||||
return loanType(LoanType.fromName(name));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user