fix office transactions data and adjust loan transactions data.
This commit is contained in:
+3
-3
@@ -4,10 +4,8 @@ import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.codehaus.jackson.map.annotate.JsonFilter;
|
||||
import org.joda.time.LocalDate;
|
||||
|
||||
@JsonFilter("myFilter")
|
||||
public class OfficeTransactionData implements Serializable {
|
||||
|
||||
private LocalDate transactionDate;
|
||||
@@ -18,8 +16,10 @@ public class OfficeTransactionData implements Serializable {
|
||||
//
|
||||
}
|
||||
|
||||
public OfficeTransactionData(final LocalDate transactionDate) {
|
||||
public OfficeTransactionData(final LocalDate transactionDate, final List<OfficeLookup> allowedOffices, final List<CurrencyData> currencyOptions) {
|
||||
this.transactionDate = transactionDate;
|
||||
this.allowedOffices = allowedOffices;
|
||||
this.currencyOptions = currencyOptions;
|
||||
}
|
||||
|
||||
public LocalDate getTransactionDate() {
|
||||
|
||||
+25
-4
@@ -64,7 +64,29 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
|
||||
|
||||
@Override
|
||||
public String convertOfficeTransactionDataToJson(final boolean prettyPrint, final Set<String> responseParameters, final OfficeTransactionData... officeTransactions) {
|
||||
return null;
|
||||
Set<String> supportedParameters = new HashSet<String>(Arrays.asList("transactionDate", "currencyOptions", "allowedOffices"));
|
||||
|
||||
final Set<String> parameterNamesToSkip = new HashSet<String>();
|
||||
|
||||
if (!responseParameters.isEmpty()) {
|
||||
if (!supportedParameters.containsAll(responseParameters)) {
|
||||
throw new UnsupportedParameterException(new ArrayList<String>(responseParameters));
|
||||
}
|
||||
|
||||
parameterNamesToSkip.addAll(supportedParameters);
|
||||
parameterNamesToSkip.removeAll(responseParameters);
|
||||
}
|
||||
|
||||
ExclusionStrategy strategy = new ParameterListExclusionStrategy(parameterNamesToSkip);
|
||||
|
||||
GsonBuilder builder = new GsonBuilder().addSerializationExclusionStrategy(strategy);
|
||||
builder.registerTypeAdapter(LocalDate.class, new JodaLocalDateAdapter());
|
||||
if (prettyPrint) {
|
||||
builder.setPrettyPrinting();
|
||||
}
|
||||
Gson gsonDeserializer = builder.create();
|
||||
|
||||
return gsonDeserializer.toJson(officeTransactions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -94,7 +116,6 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
|
||||
Gson gsonDeserializer = builder.create();
|
||||
|
||||
return gsonDeserializer.toJson(users);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -573,8 +594,8 @@ public class ApiDataConversionServiceImpl implements ApiDataConversionService {
|
||||
|
||||
Set<String> modifiedParameters = new HashSet<String>();
|
||||
|
||||
LocalDate transactionDate = extractLocalDateParameter("paymentDate", requestMap, modifiedParameters);
|
||||
BigDecimal transactionAmount = extractBigDecimalParameter("paymentAmount", requestMap, modifiedParameters);
|
||||
LocalDate transactionDate = extractLocalDateParameter("transactionDate", requestMap, modifiedParameters);
|
||||
BigDecimal transactionAmount = extractBigDecimalParameter("transactionAmount", requestMap, modifiedParameters);
|
||||
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
||||
|
||||
return new AdjustLoanTransactionCommand(loanId, transactionId, transactionDate, note, transactionAmount);
|
||||
|
||||
+5
-14
@@ -79,9 +79,10 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
context.authenticatedUser();
|
||||
|
||||
LoanMapper rm = new LoanMapper();
|
||||
|
||||
String sql = "select " + rm.loanSchema() + " where l.id = ?";
|
||||
return this.jdbcTemplate.queryForObject(sql, rm,
|
||||
new Object[] { loanId });
|
||||
|
||||
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanId });
|
||||
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
throw new LoanNotFoundException(loanId);
|
||||
@@ -240,18 +241,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService {
|
||||
workflowData.setAllowedProducts(new ArrayList<LoanProductLookup>(
|
||||
loanProducts));
|
||||
|
||||
if (loanProducts.size() == 1) {
|
||||
Long allowedProductId = workflowData.getAllowedProducts().get(0)
|
||||
.getId();
|
||||
LoanProductData selectedProduct = this.loanProductReadPlatformService
|
||||
.retrieveLoanProduct(allowedProductId);
|
||||
|
||||
workflowData.setProductId(selectedProduct.getId());
|
||||
workflowData.setProductName(selectedProduct.getName());
|
||||
workflowData.setSelectedProduct(selectedProduct);
|
||||
} else {
|
||||
LoanProductData selectedProduct = findLoanProductById(loanProducts,
|
||||
productId);
|
||||
if (productId != null) {
|
||||
LoanProductData selectedProduct = findLoanProductById(loanProducts, productId);
|
||||
|
||||
workflowData.setProductId(selectedProduct.getId());
|
||||
workflowData.setProductName(selectedProduct.getName());
|
||||
|
||||
+3
-10
@@ -175,16 +175,9 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
public OfficeTransactionData retrieveNewOfficeTransactionDetails() {
|
||||
context.authenticatedUser();
|
||||
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(
|
||||
retrieveAllOfficesForLookup());
|
||||
List<CurrencyData> currencyOptions = currencyReadPlatformService
|
||||
.retrieveAllowedCurrencies();
|
||||
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(retrieveAllOfficesForLookup());
|
||||
List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||
|
||||
OfficeTransactionData officeTransactionData = new OfficeTransactionData(
|
||||
new LocalDate());
|
||||
officeTransactionData.setAllowedOffices(parentLookups);
|
||||
officeTransactionData.setCurrencyOptions(currencyOptions);
|
||||
|
||||
return officeTransactionData;
|
||||
return new OfficeTransactionData(new LocalDate(), parentLookups, currencyOptions);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user