cosmetic office Txn changes to java
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
package org.mifosng.platform.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.DELETE;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.PUT;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import org.mifosng.platform.api.commands.ChargeCommand;
|
||||
import org.mifosng.platform.api.data.ChargeData;
|
||||
import org.mifosng.platform.api.data.EntityIdentifier;
|
||||
@@ -12,16 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.ws.rs.*;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
@Path("/charges")
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
|
||||
+6
-14
@@ -16,8 +16,7 @@ public class OfficeTransactionData {
|
||||
private final String fromOfficeName;
|
||||
private final Long toOfficeId;
|
||||
private final String toOfficeName;
|
||||
private final String currencyCode;
|
||||
private final Integer digitsAfterDecimal;
|
||||
private CurrencyData currency;
|
||||
private final BigDecimal transactionAmount;
|
||||
private final String description;
|
||||
private final List<CurrencyData> currencyOptions;
|
||||
@@ -34,8 +33,7 @@ public class OfficeTransactionData {
|
||||
this.fromOfficeName = null;
|
||||
this.toOfficeId = null;
|
||||
this.toOfficeName = null;
|
||||
this.currencyCode = null;
|
||||
this.digitsAfterDecimal = null;
|
||||
this.currency = null;
|
||||
this.transactionAmount = null;
|
||||
this.description = null;
|
||||
}
|
||||
@@ -43,16 +41,14 @@ public class OfficeTransactionData {
|
||||
public OfficeTransactionData(final Long id,
|
||||
final LocalDate transactionDate, final Long fromOfficeId,
|
||||
final String fromOfficeName, final Long toOfficeId,
|
||||
final String toOfficeName, final String currencyCode,
|
||||
final Integer digitsAfterDecimal,
|
||||
final String toOfficeName, final CurrencyData currency,
|
||||
final BigDecimal transactionAmount, final String description) {
|
||||
this.id = id;
|
||||
this.fromOfficeId = fromOfficeId;
|
||||
this.fromOfficeName = fromOfficeName;
|
||||
this.toOfficeId = toOfficeId;
|
||||
this.toOfficeName = toOfficeName;
|
||||
this.currencyCode = currencyCode;
|
||||
this.digitsAfterDecimal = digitsAfterDecimal;
|
||||
this.currency = currency;
|
||||
this.transactionAmount = transactionAmount;
|
||||
this.description = description;
|
||||
this.transactionDate = transactionDate;
|
||||
@@ -93,12 +89,8 @@ public class OfficeTransactionData {
|
||||
return toOfficeName;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return currencyCode;
|
||||
}
|
||||
|
||||
public Integer getDigitsAfterDecimal() {
|
||||
return digitsAfterDecimal;
|
||||
public CurrencyData getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public BigDecimal getTransactionAmount() {
|
||||
|
||||
+22
-8
@@ -96,7 +96,9 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
public String officeTransactionSchema() {
|
||||
return " ot.id as id, ot.transaction_date as transactionDate, ot.from_office_id as fromOfficeId, fromoff.name as fromOfficeName, "
|
||||
+ " ot.to_office_id as toOfficeId, tooff.name as toOfficeName, ot.transaction_amount as transactionAmount, ot.description as description, "
|
||||
+ " ot.currency_code as currencyCode, rc.decimal_places as digitsAfterDecimal"
|
||||
+ " ot.currency_code as currencyCode, rc.decimal_places as currencyDigits, "
|
||||
+ "rc.name as currencyName, rc.internationalized_name_code as currencyNameCode, rc.display_symbol as currencyDisplaySymbol "
|
||||
|
||||
+ " from m_office_transaction ot "
|
||||
+ " left join m_office fromoff on fromoff.id = ot.from_office_id "
|
||||
+ " left join m_office tooff on tooff.id = ot.to_office_id "
|
||||
@@ -114,16 +116,26 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
String fromOfficeName = rs.getString("fromOfficeName");
|
||||
Long toOfficeId = JdbcSupport.getLong(rs, "toOfficeId");
|
||||
String toOfficeName = rs.getString("toOfficeName");
|
||||
|
||||
String currencyCode = rs.getString("currencyCode");
|
||||
Integer digitsAfterDecimal = JdbcSupport.getInteger(rs,
|
||||
"digitsAfterDecimal");
|
||||
String currencyName = rs.getString("currencyName");
|
||||
String currencyNameCode = rs.getString("currencyNameCode");
|
||||
String currencyDisplaySymbol = rs
|
||||
.getString("currencyDisplaySymbol");
|
||||
Integer currencyDigits = JdbcSupport.getInteger(rs,
|
||||
"currencyDigits");
|
||||
|
||||
CurrencyData currencyData = new CurrencyData(currencyCode,
|
||||
currencyName, currencyDigits, currencyDisplaySymbol,
|
||||
currencyNameCode);
|
||||
|
||||
BigDecimal transactionAmount = rs
|
||||
.getBigDecimal("transactionAmount");
|
||||
String description = rs.getString("description");
|
||||
|
||||
return new OfficeTransactionData(id, transactionDate, fromOfficeId,
|
||||
fromOfficeName, toOfficeId, toOfficeName, currencyCode,
|
||||
digitsAfterDecimal, transactionAmount, description);
|
||||
fromOfficeName, toOfficeId, toOfficeName, currencyData,
|
||||
transactionAmount, description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,11 +233,13 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
|
||||
String hierarchySearchString = hierarchy + "%";
|
||||
|
||||
OfficeTransactionMapper rm = new OfficeTransactionMapper();
|
||||
String sql = "select " + rm.officeTransactionSchema()
|
||||
String sql = "select "
|
||||
+ rm.officeTransactionSchema()
|
||||
+ " where (fromoff.hierarchy like ? or tooff.hierarchy like ?) order by ot.transaction_date, ot.id";
|
||||
|
||||
return this.jdbcTemplate.query(sql, rm,
|
||||
new Object[] { hierarchySearchString, hierarchySearchString }); }
|
||||
return this.jdbcTemplate.query(sql, rm, new Object[] {
|
||||
hierarchySearchString, hierarchySearchString });
|
||||
}
|
||||
|
||||
@Override
|
||||
public OfficeTransactionData retrieveNewOfficeTransactionDetails() {
|
||||
|
||||
Reference in New Issue
Block a user