FINERACT-2169: Replace to String json to dto and clean up;
This commit is contained in:
committed by
Adam Saghy
parent
259eb75d81
commit
8c2b7bd827
+4
-10
@@ -29,7 +29,6 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collection;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.teller.data.CashierData;
|
||||
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
|
||||
@@ -41,20 +40,15 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class CashierApiResource {
|
||||
|
||||
private final DefaultToApiJsonSerializer<CashierData> jsonSerializer;
|
||||
private final TellerManagementReadPlatformService readPlatformService;
|
||||
|
||||
@GET
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getCashierData(@QueryParam("officeId") final Long officeId, @QueryParam("tellerId") final Long tellerId,
|
||||
public Collection<CashierData> getCashierData(@QueryParam("officeId") final Long officeId, @QueryParam("tellerId") final Long tellerId,
|
||||
@QueryParam("staffId") final Long staffId, @QueryParam("date") final String date) {
|
||||
final DateTimeFormatter dateFormatter = DateTimeFormatter.BASIC_ISO_DATE;
|
||||
|
||||
final LocalDate dateRestriction = (date != null ? LocalDate.parse(date, dateFormatter) : DateUtils.getBusinessLocalDate());
|
||||
|
||||
final Collection<CashierData> allCashiers = this.readPlatformService.getCashierData(officeId, tellerId, staffId, dateRestriction);
|
||||
|
||||
return this.jsonSerializer.serialize(allCashiers);
|
||||
final LocalDate dateRestriction = date != null ? LocalDate.parse(date, DateTimeFormatter.BASIC_ISO_DATE)
|
||||
: DateUtils.getBusinessLocalDate();
|
||||
return readPlatformService.getCashierData(officeId, tellerId, staffId, dateRestriction);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-11
@@ -27,9 +27,6 @@ import jakarta.ws.rs.QueryParam;
|
||||
import jakarta.ws.rs.core.MediaType;
|
||||
import java.util.Collection;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.teller.data.TellerData;
|
||||
import org.apache.fineract.organisation.teller.data.TellerJournalData;
|
||||
import org.apache.fineract.organisation.teller.service.TellerManagementReadPlatformService;
|
||||
import org.apache.fineract.organisation.teller.util.DateRange;
|
||||
@@ -41,20 +38,16 @@ import org.springframework.stereotype.Component;
|
||||
@RequiredArgsConstructor
|
||||
public class TellerJournalApiResource {
|
||||
|
||||
private final PlatformSecurityContext securityContext;
|
||||
private final DefaultToApiJsonSerializer<TellerData> jsonSerializer;
|
||||
private final TellerManagementReadPlatformService readPlatformService;
|
||||
|
||||
@GET
|
||||
@Consumes({ MediaType.TEXT_HTML, MediaType.APPLICATION_JSON })
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getJournalData(@QueryParam("officeId") final Long officeId, @QueryParam("tellerId") final Long tellerId,
|
||||
@QueryParam("cashierId") final Long cashierId, @QueryParam("dateRange") final String dateRange) {
|
||||
public Collection<TellerJournalData> getJournalData(@QueryParam("officeId") final Long officeId,
|
||||
@QueryParam("tellerId") final Long tellerId, @QueryParam("cashierId") final Long cashierId,
|
||||
@QueryParam("dateRange") final String dateRange) {
|
||||
final DateRange dateRangeHolder = DateRange.fromString(dateRange);
|
||||
|
||||
final Collection<TellerJournalData> journals = this.readPlatformService.getJournals(officeId, tellerId, cashierId,
|
||||
dateRangeHolder.getStartDate(), dateRangeHolder.getEndDate());
|
||||
|
||||
return this.jsonSerializer.serialize(journals);
|
||||
return readPlatformService.getJournals(officeId, tellerId, cashierId, dateRangeHolder.getStartDate(), dateRangeHolder.getEndDate());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user