Lombok introduction
This commit is contained in:
committed by
Arnold Gálovics
parent
e009158d7d
commit
bb514443ce
+4
-3
@@ -205,6 +205,7 @@ allprojects {
|
||||
dependency "commons-codec:commons-codec:1.15"
|
||||
dependency "org.bouncycastle:bcpkix-jdk15to18:1.70"
|
||||
dependency "org.bouncycastle:bcprov-jdk15to18:1.70"
|
||||
dependency "org.projectlombok:lombok:1.18.22"
|
||||
|
||||
|
||||
dependency ('org.apache.activemq:activemq-broker:5.17.0') {
|
||||
@@ -561,7 +562,9 @@ configure(project.fineractJavaProjects) {
|
||||
"AlmostJavadoc",
|
||||
"InvalidBlockTag",
|
||||
"JavaUtilDate", // TODO FINERACT-1298
|
||||
"ReturnValueIgnored"
|
||||
"ReturnValueIgnored",
|
||||
"SameNameButDifferent", // Until errorprone recognizes Lombok
|
||||
"MultiVariableDeclaration" // Until errorprone recognizes Lombok
|
||||
)
|
||||
error(
|
||||
"DefaultCharset",
|
||||
@@ -572,7 +575,6 @@ configure(project.fineractJavaProjects) {
|
||||
"UnnecessaryParentheses",
|
||||
"MultipleTopLevelClasses",
|
||||
"MixedMutabilityReturnType",
|
||||
"MultiVariableDeclaration",
|
||||
"AssertEqualsArgumentOrderChecker",
|
||||
"EmptySetMultibindingContributions",
|
||||
"BigDecimalEquals",
|
||||
@@ -586,7 +588,6 @@ configure(project.fineractJavaProjects) {
|
||||
"StreamResourceLeak",
|
||||
"TruthIncompatibleType",
|
||||
"ByteBufferBackingArray",
|
||||
"SameNameButDifferent",
|
||||
"OrphanedFormatString",
|
||||
"CatchAndPrintStackTrace",
|
||||
"ObjectToString",
|
||||
|
||||
@@ -132,6 +132,9 @@ dependencies {
|
||||
'org.apache.httpcomponents:httpclient'
|
||||
)
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
// testCompile dependencies are ONLY used in src/test, not src/main.
|
||||
// Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly!
|
||||
//
|
||||
|
||||
+2
-9
@@ -31,12 +31,12 @@ import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -44,19 +44,12 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@Scope("singleton")
|
||||
@Tag(name = "Periodic Accrual Accounting", description = "Periodic Accrual is to accrue the loan income till the specific date or till batch job scheduled time.\n")
|
||||
@RequiredArgsConstructor
|
||||
public class AccrualAccountingApiResource {
|
||||
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final DefaultToApiJsonSerializer<String> apiJsonSerializerService;
|
||||
|
||||
@Autowired
|
||||
public AccrualAccountingApiResource(final DefaultToApiJsonSerializer<String> apiJsonSerializerService,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.apiJsonSerializerService = apiJsonSerializerService;
|
||||
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.accrual.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.accrual.service.AccrualAccountingWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "PERIODICACCRUALACCOUNTING", action = "EXECUTE")
|
||||
@RequiredArgsConstructor
|
||||
public class ExecutePeriodicAccrualCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final AccrualAccountingWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public ExecutePeriodicAccrualCommandHandler(final AccrualAccountingWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+3
-6
@@ -31,6 +31,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.accrual.api.AccrualAccountingConstants;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -41,23 +42,19 @@ import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserial
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public final class AccrualAccountingDataValidator {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> LOAN_PERIODIC_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(accrueTillParamName, AccrualAccountingConstants.localeParamName, AccrualAccountingConstants.dateFormatParamName));
|
||||
|
||||
@Autowired
|
||||
public AccrualAccountingDataValidator(final FromJsonHelper fromApiJsonfromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper;
|
||||
}
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
public void validateLoanPeriodicAccrualData(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
|
||||
+2
-8
@@ -25,6 +25,7 @@ import static org.apache.fineract.accounting.accrual.api.AccrualAccountingConsta
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.accrual.serialization.AccrualAccountingDataValidator;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -33,22 +34,15 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.MultiException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.portfolio.loanaccount.service.LoanAccrualPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccrualAccountingWritePlatformServiceImpl implements AccrualAccountingWritePlatformService {
|
||||
|
||||
private final LoanAccrualPlatformService loanAccrualPlatformService;
|
||||
private final AccrualAccountingDataValidator accountingDataValidator;
|
||||
|
||||
@Autowired
|
||||
public AccrualAccountingWritePlatformServiceImpl(final LoanAccrualPlatformService loanAccrualPlatformService,
|
||||
final AccrualAccountingDataValidator accountingDataValidator) {
|
||||
this.loanAccrualPlatformService = loanAccrualPlatformService;
|
||||
this.accountingDataValidator = accountingDataValidator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult executeLoansPeriodicAccrual(JsonCommand command) {
|
||||
this.accountingDataValidator.validateLoanPeriodicAccrualData(command.json());
|
||||
|
||||
+4
-17
@@ -43,6 +43,7 @@ import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.data.GLClosureData;
|
||||
import org.apache.fineract.accounting.closure.service.GLClosureReadPlatformService;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -54,7 +55,6 @@ import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSeria
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -65,7 +65,7 @@ import org.springframework.stereotype.Component;
|
||||
+ "\n" + "Field Descriptions\n" + "closingDate\n" + "The date for which the accounting closure is defined\n" + "officeId\n"
|
||||
+ "The identifer of the branch for which accounting has been closed\n" + "comments\n"
|
||||
+ "Description associated with an Accounting closure")
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class GLClosuresApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
@@ -74,25 +74,12 @@ public class GLClosuresApiResource {
|
||||
|
||||
private final String resourceNameForPermission = "GLCLOSURE";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final GLClosureReadPlatformService glClosureReadPlatformService;
|
||||
private final OfficeReadPlatformService officeReadPlatformService;
|
||||
private final DefaultToApiJsonSerializer<GLClosureData> apiJsonSerializerService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PlatformSecurityContext context;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
|
||||
@Autowired
|
||||
public GLClosuresApiResource(final PlatformSecurityContext context, final GLClosureReadPlatformService glClosureReadPlatformService,
|
||||
final DefaultToApiJsonSerializer<GLClosureData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final OfficeReadPlatformService officeReadPlatformService) {
|
||||
this.context = context;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.apiJsonSerializerService = toApiJsonSerializer;
|
||||
this.glClosureReadPlatformService = glClosureReadPlatformService;
|
||||
this.officeReadPlatformService = officeReadPlatformService;
|
||||
}
|
||||
private final OfficeReadPlatformService officeReadPlatformService;
|
||||
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+4
-8
@@ -21,6 +21,8 @@ package org.apache.fineract.accounting.closure.command;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -29,21 +31,15 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
/**
|
||||
* Immutable command for adding an accounting closure
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class GLClosureCommand {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
private final Long officeId;
|
||||
private final LocalDate closingDate;
|
||||
private final String comments;
|
||||
|
||||
public GLClosureCommand(final Long id, final Long officeId, final LocalDate closingDate, final String comments) {
|
||||
this.id = id;
|
||||
this.officeId = officeId;
|
||||
this.closingDate = closingDate;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
+6
-39
@@ -21,6 +21,9 @@ package org.apache.fineract.accounting.closure.data;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
|
||||
/**
|
||||
@@ -28,59 +31,23 @@ import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
*
|
||||
* Note: no getter/setters required as google-gson will produce json from fields of object.
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class GLClosureData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long officeId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String officeName;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate closingDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean deleted;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate createdDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate lastUpdatedDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long createdByUserId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String createdByUsername;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long lastUpdatedByUserId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String lastUpdatedByUsername;
|
||||
@SuppressWarnings("unused")
|
||||
private final String comments;
|
||||
|
||||
@Setter
|
||||
private Collection<OfficeData> allowedOffices = new ArrayList<>();
|
||||
|
||||
public GLClosureData(final Long id, final Long officeId, final String officeName, final LocalDate closingDate, final boolean deleted,
|
||||
final LocalDate createdDate, final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername,
|
||||
final Long lastUpdatedByUserId, final String lastUpdatedByUsername, final String comments) {
|
||||
this.id = id;
|
||||
this.officeId = officeId;
|
||||
this.officeName = officeName;
|
||||
this.closingDate = closingDate;
|
||||
this.deleted = deleted;
|
||||
this.createdDate = createdDate;
|
||||
this.lastUpdatedDate = lastUpdatedDate;
|
||||
this.createdByUserId = createdByUserId;
|
||||
this.createdByUsername = createdByUsername;
|
||||
this.lastUpdatedByUserId = lastUpdatedByUserId;
|
||||
this.lastUpdatedByUsername = lastUpdatedByUsername;
|
||||
this.comments = comments;
|
||||
this.allowedOffices = null;
|
||||
}
|
||||
|
||||
public final Collection<OfficeData> getAllowedOffices() {
|
||||
return this.allowedOffices;
|
||||
}
|
||||
|
||||
public void setAllowedOffices(final Collection<OfficeData> allowedOffices) {
|
||||
this.allowedOffices = allowedOffices;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.service.GLClosureWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "GLCLOSURE", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateGLClosureCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final GLClosureWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateGLClosureCommandHandler(final GLClosureWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.service.GLClosureWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "GLCLOSURE", action = "DELETE")
|
||||
@RequiredArgsConstructor
|
||||
public class DeleteGLClosureCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final GLClosureWritePlatformService closureWritePlatformService;
|
||||
|
||||
@Autowired
|
||||
public DeleteGLClosureCommandHandler(final GLClosureWritePlatformService guarantorWritePlatformService) {
|
||||
this.closureWritePlatformService = guarantorWritePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.closure.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.service.GLClosureWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "GLCLOSURE", action = "UPDATE")
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateGLClosureCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final GLClosureWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public UpdateGLClosureCommandHandler(final GLClosureWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -24,6 +24,7 @@ import java.lang.reflect.Type;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
import org.apache.fineract.accounting.closure.command.GLClosureCommand;
|
||||
@@ -32,22 +33,17 @@ import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJson
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public final class GLClosureCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLClosureCommand> {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public GLClosureCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonfromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GLClosureCommand commandFromApiJson(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
|
||||
+2
-6
@@ -23,25 +23,21 @@ import java.sql.SQLException;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.data.GLClosureData;
|
||||
import org.apache.fineract.accounting.closure.exception.GLClosureNotFoundException;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GLClosureReadPlatformServiceImpl implements GLClosureReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public GLClosureReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
private static final class GLClosureMapper implements RowMapper<GLClosureData> {
|
||||
|
||||
public String schema() {
|
||||
|
||||
+5
-14
@@ -21,6 +21,8 @@ package org.apache.fineract.accounting.closure.service;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
import org.apache.fineract.accounting.closure.command.GLClosureCommand;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
@@ -38,9 +40,6 @@ import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityEx
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
@@ -48,22 +47,14 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosureWritePlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GLClosureWritePlatformServiceJpaRepositoryImpl.class);
|
||||
|
||||
private final GLClosureRepository glClosureRepository;
|
||||
private final OfficeRepositoryWrapper officeRepositoryWrapper;
|
||||
private final GLClosureCommandFromApiJsonDeserializer fromApiJsonDeserializer;
|
||||
|
||||
@Autowired
|
||||
public GLClosureWritePlatformServiceJpaRepositoryImpl(final GLClosureRepository glClosureRepository,
|
||||
final OfficeRepositoryWrapper officeRepositoryWrapper, final GLClosureCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
|
||||
this.glClosureRepository = glClosureRepository;
|
||||
this.officeRepositoryWrapper = officeRepositoryWrapper;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult createGLClosure(final JsonCommand command) {
|
||||
@@ -154,7 +145,7 @@ public class GLClosureWritePlatformServiceJpaRepositoryImpl implements GLClosure
|
||||
DateUtils.getDateTimeZoneOfTenant()));
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
log.error("Error occured.", dve);
|
||||
throw new PlatformDataIntegrityException("error.msg.glClosure.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource GL Closure: " + realCause.getMessage());
|
||||
}
|
||||
|
||||
+2
-6
@@ -21,25 +21,21 @@ package org.apache.fineract.accounting.common;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService;
|
||||
import org.apache.fineract.accounting.journalentry.domain.JournalEntryType;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingDropdownReadPlatformServiceImpl implements AccountingDropdownReadPlatformService {
|
||||
|
||||
private final GLAccountReadPlatformService accountReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public AccountingDropdownReadPlatformServiceImpl(final GLAccountReadPlatformService accountReadPlatformService) {
|
||||
this.accountReadPlatformService = accountReadPlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EnumOptionData> retrieveGLAccountTypeOptions() {
|
||||
return AccountingEnumerations.gLAccountType(GLAccountType.values());
|
||||
|
||||
+3
-15
@@ -39,6 +39,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityAccountData;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountReadPlatformService;
|
||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
||||
@@ -49,7 +50,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
|
||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -59,27 +59,15 @@ import org.springframework.stereotype.Component;
|
||||
@Tag(name = "Mapping Financial Activities to Accounts", description = "Organization Level Financial Activities like Asset and Liability Transfer can be mapped to GL Account. Integrated accounting takes these accounts into consideration when an Account transfer is made between a savings to loan/savings account and vice-versa\n"
|
||||
+ "\n" + "Field Descriptions\n" + "financialActivityId\n" + "The identifier of the Financial Activity\n" + "glAccountId\n"
|
||||
+ "The identifier of a GL Account ( Ledger Account) which shall be used as the default account for the selected Financial Activity")
|
||||
@RequiredArgsConstructor
|
||||
public class FinancialActivityAccountsApiResource {
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final FinancialActivityAccountReadPlatformService financialActivityAccountReadPlatformService;
|
||||
private final DefaultToApiJsonSerializer<FinancialActivityAccountData> apiJsonSerializerService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PlatformSecurityContext context;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
|
||||
@Autowired
|
||||
public FinancialActivityAccountsApiResource(final PlatformSecurityContext context,
|
||||
final FinancialActivityAccountReadPlatformService officeToGLAccountMappingReadPlatformService,
|
||||
final DefaultToApiJsonSerializer<FinancialActivityAccountData> toApiJsonSerializer,
|
||||
final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
||||
this.context = context;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.apiJsonSerializerService = toApiJsonSerializer;
|
||||
this.financialActivityAccountReadPlatformService = officeToGLAccountMappingReadPlatformService;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+7
-46
@@ -20,14 +20,21 @@ package org.apache.fineract.accounting.financialactivityaccount.data;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class FinancialActivityAccountData {
|
||||
|
||||
private final Long id;
|
||||
private final FinancialActivityData financialActivityData;
|
||||
private final GLAccountData glAccountData;
|
||||
@Setter
|
||||
private Map<String, List<GLAccountData>> glAccountOptions;
|
||||
@Setter
|
||||
private List<FinancialActivityData> financialActivityOptions;
|
||||
|
||||
public FinancialActivityAccountData() {
|
||||
@@ -37,50 +44,4 @@ public class FinancialActivityAccountData {
|
||||
this.glAccountOptions = null;
|
||||
this.financialActivityOptions = null;
|
||||
}
|
||||
|
||||
public FinancialActivityAccountData(final Long id, final FinancialActivityData financialActivityData,
|
||||
final GLAccountData glAccountData) {
|
||||
this.id = id;
|
||||
this.glAccountData = glAccountData;
|
||||
this.financialActivityData = financialActivityData;
|
||||
}
|
||||
|
||||
public FinancialActivityAccountData(Map<String, List<GLAccountData>> glAccountOptions,
|
||||
List<FinancialActivityData> financialActivityOptions) {
|
||||
this.id = null;
|
||||
this.glAccountData = null;
|
||||
this.financialActivityData = null;
|
||||
this.glAccountOptions = glAccountOptions;
|
||||
this.financialActivityOptions = financialActivityOptions;
|
||||
|
||||
}
|
||||
|
||||
public List<FinancialActivityData> getFinancialActivityOptions() {
|
||||
return financialActivityOptions;
|
||||
}
|
||||
|
||||
public void setFinancialActivityOptions(List<FinancialActivityData> financialActivityOptions) {
|
||||
this.financialActivityOptions = financialActivityOptions;
|
||||
}
|
||||
|
||||
public Map<String, List<GLAccountData>> getAccountingMappingOptions() {
|
||||
return this.glAccountOptions;
|
||||
}
|
||||
|
||||
public void setAccountingMappingOptions(Map<String, List<GLAccountData>> accountingMappingOptions) {
|
||||
this.glAccountOptions = accountingMappingOptions;
|
||||
}
|
||||
|
||||
public GLAccountData getGlAccountData() {
|
||||
return glAccountData;
|
||||
}
|
||||
|
||||
public FinancialActivityData getFinancialActivityData() {
|
||||
return financialActivityData;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-20
@@ -18,31 +18,15 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.financialactivityaccount.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class FinancialActivityData {
|
||||
|
||||
private final Integer id;
|
||||
private final String name;
|
||||
private final GLAccountType mappedGLAccountType;
|
||||
|
||||
public Integer getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public GLAccountType getMappedGLAccountType() {
|
||||
return this.mappedGLAccountType;
|
||||
}
|
||||
|
||||
public FinancialActivityData(Integer id, String name, GLAccountType mappedGLAccountType) {
|
||||
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.mappedGLAccountType = mappedGLAccountType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.financialactivityaccount.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateFinancialActivityAccountHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final FinancialActivityAccountWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateFinancialActivityAccountHandler(final FinancialActivityAccountWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.financialactivityaccount.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "DELETE")
|
||||
@RequiredArgsConstructor
|
||||
public class DeleteFinancialActivityAccountCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final FinancialActivityAccountWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public DeleteFinancialActivityAccountCommandHandler(final FinancialActivityAccountWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.financialactivityaccount.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.service.FinancialActivityAccountWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "FINANCIALACTIVITYACCOUNT", action = "UPDATE")
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateFinancialActivityAccountCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final FinancialActivityAccountWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public UpdateFinancialActivityAccountCommandHandler(final FinancialActivityAccountWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+3
-7
@@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.api.FinancialActivityAccountsJsonInputParams;
|
||||
@@ -33,10 +34,10 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public final class FinancialActivityAccountDataValidator {
|
||||
|
||||
/**
|
||||
@@ -44,15 +45,10 @@ public final class FinancialActivityAccountDataValidator {
|
||||
*/
|
||||
private final Set<String> supportedParameters = FinancialActivityAccountsJsonInputParams.getAllValues();
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
private final String paramNameForFinancialActivity = FinancialActivityAccountsJsonInputParams.FINANCIAL_ACTIVITY_ID.getValue();
|
||||
private final String paramNameForGLAccount = FinancialActivityAccountsJsonInputParams.GL_ACCOUNT_ID.getValue();
|
||||
|
||||
@Autowired
|
||||
public FinancialActivityAccountDataValidator(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
public void validateForCreate(final String json) {
|
||||
validateJSONAndCheckForUnsupportedParams(json);
|
||||
|
||||
+4
-11
@@ -22,6 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.data.FinancialActivityAccountData;
|
||||
@@ -29,26 +30,18 @@ import org.apache.fineract.accounting.financialactivityaccount.data.FinancialAct
|
||||
import org.apache.fineract.accounting.financialactivityaccount.exception.FinancialActivityAccountNotFoundException;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FinancialActivityAccountReadPlatformServiceImpl implements FinancialActivityAccountReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final FinancialActivityAccountMapper financialActivityAccountMapper;
|
||||
private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public FinancialActivityAccountReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate,
|
||||
final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService) {
|
||||
financialActivityAccountMapper = new FinancialActivityAccountMapper();
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.accountingDropdownReadPlatformService = accountingDropdownReadPlatformService;
|
||||
}
|
||||
private final FinancialActivityAccountMapper financialActivityAccountMapper = new FinancialActivityAccountMapper();
|
||||
|
||||
@Override
|
||||
public List<FinancialActivityAccountData> retrieveAll() {
|
||||
@@ -73,7 +66,7 @@ public class FinancialActivityAccountReadPlatformServiceImpl implements Financia
|
||||
@Override
|
||||
public FinancialActivityAccountData addTemplateDetails(FinancialActivityAccountData financialActivityAccountData) {
|
||||
final Map<String, List<GLAccountData>> accountOptions = this.accountingDropdownReadPlatformService.retrieveAccountMappingOptions();
|
||||
financialActivityAccountData.setAccountingMappingOptions(accountOptions);
|
||||
financialActivityAccountData.setGlAccountOptions(accountOptions);
|
||||
financialActivityAccountData.setFinancialActivityOptions(FinancialActivity.getAllFinancialActivities());
|
||||
return financialActivityAccountData;
|
||||
}
|
||||
|
||||
+6
-16
@@ -21,6 +21,8 @@ package org.apache.fineract.accounting.financialactivityaccount.service;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.persistence.PersistenceException;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.api.FinancialActivityAccountsJsonInputParams;
|
||||
@@ -35,31 +37,19 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class FinancialActivityAccountWritePlatformServiceImpl implements FinancialActivityAccountWritePlatformService {
|
||||
|
||||
private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository;
|
||||
private final FinancialActivityAccountDataValidator fromApiJsonDeserializer;
|
||||
private final GLAccountRepositoryWrapper glAccountRepositoryWrapper;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FinancialActivityAccountWritePlatformServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
public FinancialActivityAccountWritePlatformServiceImpl(
|
||||
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository,
|
||||
final FinancialActivityAccountDataValidator fromApiJsonDeserializer,
|
||||
final GLAccountRepositoryWrapper glAccountRepositoryWrapper) {
|
||||
this.financialActivityAccountRepository = financialActivityAccountRepository;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
this.glAccountRepositoryWrapper = glAccountRepositoryWrapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult createFinancialActivityAccountMapping(JsonCommand command) {
|
||||
@@ -158,7 +148,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
|
||||
throw new DuplicateFinancialActivityAccountFoundException(financialActivityId);
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
log.error("Error occured.", dve);
|
||||
throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource GL Account: " + realCause.getMessage());
|
||||
}
|
||||
@@ -170,7 +160,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi
|
||||
throw new DuplicateFinancialActivityAccountFoundException(financialActivityId);
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
log.error("Error occured.", dve);
|
||||
throw new PlatformDataIntegrityException("error.msg.glAccount.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource GL Account: " + realCause.getMessage());
|
||||
}
|
||||
|
||||
+4
-21
@@ -46,6 +46,7 @@ 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 lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants;
|
||||
import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
@@ -69,7 +70,6 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -78,6 +78,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
@Tag(name = "General Ledger Account", description = "Ledger accounts represent an Individual account within an Organizations Chart Of Accounts(COA) and are assigned a name and unique number by which they can be identified. \n"
|
||||
+ "All transactions relating to a company's assets, liabilities, owners' equity, revenue and expenses are recorded against these accounts")
|
||||
@RequiredArgsConstructor
|
||||
public class GLAccountsApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "parentId", "glCode", "disabled",
|
||||
@@ -88,34 +89,16 @@ public class GLAccountsApiResource {
|
||||
|
||||
private final String resourceNameForPermission = "GLACCOUNT";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final GLAccountReadPlatformService glAccountReadPlatformService;
|
||||
private final AccountingDropdownReadPlatformService dropdownReadPlatformService;
|
||||
private final DefaultToApiJsonSerializer<GLAccountData> apiJsonSerializerService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PlatformSecurityContext context;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final AccountingDropdownReadPlatformService dropdownReadPlatformService;
|
||||
private final CodeValueReadPlatformService codeValueReadPlatformService;
|
||||
private final BulkImportWorkbookService bulkImportWorkbookService;
|
||||
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
||||
|
||||
@Autowired
|
||||
public GLAccountsApiResource(final PlatformSecurityContext context, final GLAccountReadPlatformService glAccountReadPlatformService,
|
||||
final DefaultToApiJsonSerializer<GLAccountData> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final AccountingDropdownReadPlatformService dropdownReadPlatformService,
|
||||
final CodeValueReadPlatformService codeValueReadPlatformService, final BulkImportWorkbookService bulkImportWorkbookService,
|
||||
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
|
||||
this.context = context;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.apiJsonSerializerService = toApiJsonSerializer;
|
||||
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
||||
this.dropdownReadPlatformService = dropdownReadPlatformService;
|
||||
this.codeValueReadPlatformService = codeValueReadPlatformService;
|
||||
this.bulkImportWorkbookService = bulkImportWorkbookService;
|
||||
this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+5
-16
@@ -20,6 +20,8 @@ package org.apache.fineract.accounting.glaccount.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.api.GLAccountJsonInputParams;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage;
|
||||
@@ -30,34 +32,21 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
/**
|
||||
* Immutable command for adding a general Ledger Account
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class GLAccountCommand {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
private final String name;
|
||||
private final Long parentId;
|
||||
private final String glCode;
|
||||
private final Boolean disabled;
|
||||
private final Boolean manualEntriesAllowed;
|
||||
private final Integer usage;
|
||||
private final Integer type;
|
||||
private final Integer usage;
|
||||
private final String description;
|
||||
private final Long tagId;
|
||||
|
||||
public GLAccountCommand(final Long id, final String name, final Long parentId, final String glCode, final Boolean disabled,
|
||||
final Boolean manualEntriesAllowed, final Integer type, final Integer usage, final String description, final Long tagId) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.parentId = parentId;
|
||||
this.glCode = glCode;
|
||||
this.disabled = disabled;
|
||||
this.manualEntriesAllowed = manualEntriesAllowed;
|
||||
this.type = type;
|
||||
this.usage = usage;
|
||||
this.description = description;
|
||||
this.tagId = tagId;
|
||||
}
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
|
||||
+5
-13
@@ -18,22 +18,14 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.glaccount.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class GLAccountDataForLookup {
|
||||
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String name;
|
||||
@SuppressWarnings("unused")
|
||||
private final String glCode;
|
||||
|
||||
public GLAccountDataForLookup(final Long id, final String name, final String glCode) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.glCode = glCode;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.glaccount.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "GLACCOUNT", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateGLAccountCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final GLAccountWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateGLAccountCommandHandler(final GLAccountWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.glaccount.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "GLACCOUNT", action = "DELETE")
|
||||
@RequiredArgsConstructor
|
||||
public class DeleteGLAccountCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final GLAccountWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public DeleteGLAccountCommandHandler(final GLAccountWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.glaccount.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "GLACCOUNT", action = "UPDATE")
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateGLAccountCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final GLAccountWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public UpdateGLAccountCommandHandler(final GLAccountWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -23,6 +23,7 @@ import com.google.gson.reflect.TypeToken;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.glaccount.api.GLAccountJsonInputParams;
|
||||
import org.apache.fineract.accounting.glaccount.command.GLAccountCommand;
|
||||
@@ -31,22 +32,17 @@ import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJson
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.loanaccount.guarantor.command.GuarantorCommand;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implementation of {@link FromApiJsonDeserializer} for {@link GuarantorCommand}'s.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public final class GLAccountCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<GLAccountCommand> {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public GLAccountCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonfromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GLAccountCommand commandFromApiJson(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
|
||||
+3
-6
@@ -22,6 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingEnumerations;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
@@ -34,22 +35,18 @@ import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationP
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GLAccountReadPlatformServiceImpl implements GLAccountReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private static final String nameDecoratedBaseOnHierarchy = "concat(substring('........................................', 1, ((LENGTH(hierarchy) - LENGTH(REPLACE(hierarchy, '.', '')) - 1) * 4)), name)";
|
||||
|
||||
@Autowired
|
||||
public GLAccountReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
private static final class GLAccountMapper implements RowMapper<GLAccountData> {
|
||||
|
||||
|
||||
+2
-12
@@ -20,6 +20,7 @@ package org.apache.fineract.accounting.glaccount.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants;
|
||||
import org.apache.fineract.accounting.glaccount.api.GLAccountJsonInputParams;
|
||||
import org.apache.fineract.accounting.glaccount.command.GLAccountCommand;
|
||||
@@ -46,7 +47,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
@@ -56,6 +56,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccountWritePlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(GLAccountWritePlatformServiceJpaRepositoryImpl.class);
|
||||
@@ -66,17 +67,6 @@ public class GLAccountWritePlatformServiceJpaRepositoryImpl implements GLAccount
|
||||
private final CodeValueRepositoryWrapper codeValueRepositoryWrapper;
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public GLAccountWritePlatformServiceJpaRepositoryImpl(final GLAccountRepository glAccountRepository,
|
||||
final JournalEntryRepository glJournalEntryRepository, final GLAccountCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
||||
final CodeValueRepositoryWrapper codeValueRepositoryWrapper, final JdbcTemplate jdbcTemplate) {
|
||||
this.glAccountRepository = glAccountRepository;
|
||||
this.glJournalEntryRepository = glJournalEntryRepository;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
this.codeValueRepositoryWrapper = codeValueRepositoryWrapper;
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult createGLAccount(final JsonCommand command) {
|
||||
|
||||
+3
-18
@@ -43,6 +43,7 @@ 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 lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.journalentry.command.JournalEntryCommand;
|
||||
import org.apache.fineract.accounting.journalentry.data.JournalEntryAssociationParametersData;
|
||||
@@ -67,7 +68,6 @@ import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.glassfish.jersey.media.multipart.FormDataContentDisposition;
|
||||
import org.glassfish.jersey.media.multipart.FormDataParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -76,6 +76,7 @@ import org.springframework.stereotype.Component;
|
||||
@Scope("singleton")
|
||||
@Tag(name = "Journal Entries", description = "A journal entry refers to the logging of transactions against general ledger accounts. A journal entry may consist of several line items, each of which is either a \"debit\" or a \"credit\". The total amount of the debits must equal the total amount of the credits or the journal entry is said to be \"unbalanced\" \n"
|
||||
+ "\n" + "A journal entry directly changes the account balances on the general ledger")
|
||||
@RequiredArgsConstructor
|
||||
public class JournalEntriesApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
@@ -85,30 +86,14 @@ public class JournalEntriesApiResource {
|
||||
|
||||
private final String resourceNameForPermission = "JOURNALENTRY";
|
||||
|
||||
private final PlatformSecurityContext context;
|
||||
private final JournalEntryReadPlatformService journalEntryReadPlatformService;
|
||||
private final DefaultToApiJsonSerializer<Object> apiJsonSerializerService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private final PlatformSecurityContext context;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final BulkImportWorkbookService bulkImportWorkbookService;
|
||||
private final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService;
|
||||
|
||||
@Autowired
|
||||
public JournalEntriesApiResource(final PlatformSecurityContext context,
|
||||
final JournalEntryReadPlatformService journalEntryReadPlatformService,
|
||||
final DefaultToApiJsonSerializer<Object> toApiJsonSerializer, final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final BulkImportWorkbookService bulkImportWorkbookService,
|
||||
final BulkImportWorkbookPopulatorService bulkImportWorkbookPopulatorService) {
|
||||
this.context = context;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.apiJsonSerializerService = toApiJsonSerializer;
|
||||
this.journalEntryReadPlatformService = journalEntryReadPlatformService;
|
||||
this.bulkImportWorkbookService = bulkImportWorkbookService;
|
||||
this.bulkImportWorkbookPopulatorService = bulkImportWorkbookPopulatorService;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
@Produces({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+5
-57
@@ -22,6 +22,8 @@ import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
@@ -30,52 +32,27 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
/**
|
||||
* Immutable command for adding an accounting closure
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class JournalEntryCommand {
|
||||
|
||||
private final Long officeId;
|
||||
private final LocalDate transactionDate;
|
||||
private final String currencyCode;
|
||||
private final LocalDate transactionDate;
|
||||
private final String comments;
|
||||
private final String referenceNumber;
|
||||
private final Long accountingRuleId;
|
||||
private final BigDecimal amount;
|
||||
private final Long paymentTypeId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String accountNumber;
|
||||
@SuppressWarnings("unused")
|
||||
private final String checkNumber;
|
||||
@SuppressWarnings("unused")
|
||||
private final String receiptNumber;
|
||||
@SuppressWarnings("unused")
|
||||
private final String bankNumber;
|
||||
@SuppressWarnings("unused")
|
||||
private final String routingCode;
|
||||
|
||||
private final SingleDebitOrCreditEntryCommand[] credits;
|
||||
private final SingleDebitOrCreditEntryCommand[] debits;
|
||||
|
||||
public JournalEntryCommand(final Long officeId, final String currencyCode, final LocalDate transactionDate, final String comments,
|
||||
final SingleDebitOrCreditEntryCommand[] credits, final SingleDebitOrCreditEntryCommand[] debits, final String referenceNumber,
|
||||
final Long accountingRuleId, final BigDecimal amount, final Long paymentTypeId, final String accountNumber,
|
||||
final String checkNumber, final String receiptNumber, final String bankNumber, final String routingCode) {
|
||||
this.officeId = officeId;
|
||||
this.currencyCode = currencyCode;
|
||||
this.transactionDate = transactionDate;
|
||||
this.comments = comments;
|
||||
this.credits = credits;
|
||||
this.debits = debits;
|
||||
this.referenceNumber = referenceNumber;
|
||||
this.accountingRuleId = accountingRuleId;
|
||||
this.amount = amount;
|
||||
this.paymentTypeId = paymentTypeId;
|
||||
this.accountNumber = accountNumber;
|
||||
this.checkNumber = checkNumber;
|
||||
this.receiptNumber = receiptNumber;
|
||||
this.bankNumber = bankNumber;
|
||||
this.routingCode = routingCode;
|
||||
|
||||
}
|
||||
|
||||
public void validateForCreate() {
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
@@ -141,33 +118,4 @@ public class JournalEntryCommand {
|
||||
baseDataValidator.reset().parameter(paramSuffix + "[" + arrayPos + "].amount").value(credit.getAmount()).notNull()
|
||||
.zeroOrPositiveAmount();
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public LocalDate getTransactionDate() {
|
||||
return this.transactionDate;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return this.comments;
|
||||
}
|
||||
|
||||
public SingleDebitOrCreditEntryCommand[] getCredits() {
|
||||
return this.credits;
|
||||
}
|
||||
|
||||
public SingleDebitOrCreditEntryCommand[] getDebits() {
|
||||
return this.debits;
|
||||
}
|
||||
|
||||
public String getReferenceNumber() {
|
||||
return this.referenceNumber;
|
||||
}
|
||||
|
||||
public Long getAccountingRuleId() {
|
||||
return this.accountingRuleId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-25
@@ -20,10 +20,14 @@ package org.apache.fineract.accounting.journalentry.command;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Immutable command for adding a "Credit" entry to the Journal
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class SingleDebitOrCreditEntryCommand {
|
||||
|
||||
private final Long glAccountId;
|
||||
@@ -32,14 +36,6 @@ public class SingleDebitOrCreditEntryCommand {
|
||||
|
||||
private final Set<String> parametersPassedInRequest;
|
||||
|
||||
public SingleDebitOrCreditEntryCommand(final Set<String> parametersPassedInRequest, final Long glAccountId, final BigDecimal amount,
|
||||
final String comments) {
|
||||
this.parametersPassedInRequest = parametersPassedInRequest;
|
||||
this.glAccountId = glAccountId;
|
||||
this.amount = amount;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public boolean isGlAccountIdChanged() {
|
||||
return this.parametersPassedInRequest.contains("glAccountId");
|
||||
}
|
||||
@@ -51,21 +47,4 @@ public class SingleDebitOrCreditEntryCommand {
|
||||
public boolean isCommentsChanged() {
|
||||
return this.parametersPassedInRequest.contains("comments");
|
||||
}
|
||||
|
||||
public Long getGlAccountId() {
|
||||
return this.glAccountId;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return this.comments;
|
||||
}
|
||||
|
||||
public Set<String> getParametersPassedInRequest() {
|
||||
return this.parametersPassedInRequest;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-20
@@ -19,30 +19,14 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class ChargePaymentDTO {
|
||||
|
||||
private final Long chargeId;
|
||||
private final BigDecimal amount;
|
||||
private final Long loanChargeId;
|
||||
|
||||
public ChargePaymentDTO(final Long chargeId, final Long loanChargeId, final BigDecimal amount) {
|
||||
this.chargeId = chargeId;
|
||||
this.amount = amount;
|
||||
this.loanChargeId = loanChargeId;
|
||||
|
||||
}
|
||||
|
||||
public Long getChargeId() {
|
||||
return this.chargeId;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public Long getLoanChargeId() {
|
||||
return this.loanChargeId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-30
@@ -19,7 +19,11 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class ClientChargePaymentDTO {
|
||||
|
||||
private final Long chargeId;
|
||||
@@ -27,34 +31,4 @@ public class ClientChargePaymentDTO {
|
||||
private final Long clientChargeId;
|
||||
private final boolean isPenalty;
|
||||
private final Long incomeAccountId;
|
||||
|
||||
public ClientChargePaymentDTO(Long chargeId, BigDecimal amount, Long clientChargeId, boolean isPenalty, Long incomeAccountId) {
|
||||
|
||||
this.chargeId = chargeId;
|
||||
this.amount = amount;
|
||||
this.clientChargeId = clientChargeId;
|
||||
this.isPenalty = isPenalty;
|
||||
this.incomeAccountId = incomeAccountId;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public Long getClientChargeId() {
|
||||
return this.clientChargeId;
|
||||
}
|
||||
|
||||
public boolean isPenalty() {
|
||||
return this.isPenalty;
|
||||
}
|
||||
|
||||
public Long getChargeId() {
|
||||
return chargeId;
|
||||
}
|
||||
|
||||
public Long getIncomeAccountId() {
|
||||
return this.incomeAccountId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-67
@@ -21,92 +21,35 @@ package org.apache.fineract.accounting.journalentry.data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.portfolio.client.domain.ClientTransactionType;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class ClientTransactionDTO {
|
||||
|
||||
private final Long officeId;
|
||||
private final Long clientId;
|
||||
private String currencyCode;
|
||||
private final Long officeId;
|
||||
|
||||
private final Long paymentTypeId;
|
||||
private final Long transactionId;
|
||||
private final Date transactionDate;
|
||||
private final Long paymentTypeId;
|
||||
private final EnumOptionData transactionType;
|
||||
private final String currencyCode;
|
||||
|
||||
private final BigDecimal amount;
|
||||
|
||||
private final Boolean accountingEnabled;
|
||||
|
||||
/*** Boolean values determines if the transaction is reversed ***/
|
||||
private final boolean reversed;
|
||||
|
||||
private final boolean accountingEnabled;
|
||||
|
||||
/** Breakdowns of fees this Transaction pays **/
|
||||
private final List<ClientChargePaymentDTO> chargePayments;
|
||||
|
||||
public ClientTransactionDTO(final Long clientId, final Long officeId, final Long paymentTypeId, final Long transactionId,
|
||||
final Date transactionDate, final EnumOptionData transactionType, final String currencyCode, final BigDecimal amount,
|
||||
final boolean reversed, final boolean accountingEnabled, final List<ClientChargePaymentDTO> clientChargePayments) {
|
||||
this.clientId = clientId;
|
||||
this.paymentTypeId = paymentTypeId;
|
||||
this.transactionId = transactionId;
|
||||
this.transactionDate = transactionDate;
|
||||
this.amount = amount;
|
||||
this.reversed = reversed;
|
||||
this.transactionType = transactionType;
|
||||
this.chargePayments = clientChargePayments;
|
||||
this.officeId = officeId;
|
||||
this.accountingEnabled = accountingEnabled;
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
return this.transactionDate;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public boolean isReversed() {
|
||||
return this.reversed;
|
||||
}
|
||||
|
||||
public Long getPaymentTypeId() {
|
||||
return this.paymentTypeId;
|
||||
}
|
||||
|
||||
public EnumOptionData getTransactionType() {
|
||||
return transactionType;
|
||||
}
|
||||
|
||||
public boolean isChargePayment() {
|
||||
return ClientTransactionType.PAY_CHARGE.getValue().equals(Integer.valueOf(this.transactionType.getId().intValue()));
|
||||
return ClientTransactionType.PAY_CHARGE.getValue().equals(this.transactionType.getId().intValue());
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
|
||||
public List<ClientChargePaymentDTO> getChargePayments() {
|
||||
return this.chargePayments;
|
||||
}
|
||||
|
||||
public Long getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public Boolean getAccountingEnabled() {
|
||||
return this.accountingEnabled;
|
||||
}
|
||||
|
||||
public Long getClientId() {
|
||||
return this.clientId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-5
@@ -19,14 +19,13 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class CreditDebit {
|
||||
|
||||
private final Long glAccountId;
|
||||
private final BigDecimal amount;
|
||||
|
||||
public CreditDebit(Long glAccountId, BigDecimal amount) {
|
||||
this.glAccountId = glAccountId;
|
||||
this.amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-13
@@ -18,6 +18,11 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class JournalEntryAssociationParametersData {
|
||||
|
||||
private final boolean transactionDetailsRequired;
|
||||
@@ -27,17 +32,4 @@ public class JournalEntryAssociationParametersData {
|
||||
this.transactionDetailsRequired = false;
|
||||
this.runningBalanceRequired = false;
|
||||
}
|
||||
|
||||
public JournalEntryAssociationParametersData(final boolean transactionDetailsRequired, final boolean runningBalanceRequired) {
|
||||
this.transactionDetailsRequired = transactionDetailsRequired;
|
||||
this.runningBalanceRequired = runningBalanceRequired;
|
||||
}
|
||||
|
||||
public boolean isTransactionDetailsRequired() {
|
||||
return this.transactionDetailsRequired;
|
||||
}
|
||||
|
||||
public boolean isRunningBalanceRequired() {
|
||||
return this.runningBalanceRequired;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-73
@@ -19,86 +19,26 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class LoanDTO {
|
||||
|
||||
@Setter
|
||||
private Long loanId;
|
||||
@Setter
|
||||
private Long loanProductId;
|
||||
@Setter
|
||||
private Long officeId;
|
||||
|
||||
@Setter
|
||||
private String currencyCode;
|
||||
@Setter
|
||||
private boolean cashBasedAccountingEnabled;
|
||||
final boolean upfrontAccrualBasedAccountingEnabled;
|
||||
final boolean periodicAccrualBasedAccountingEnabled;
|
||||
private final boolean upfrontAccrualBasedAccountingEnabled;
|
||||
private final boolean periodicAccrualBasedAccountingEnabled;
|
||||
@Setter
|
||||
private List<LoanTransactionDTO> newLoanTransactions;
|
||||
|
||||
public LoanDTO(final Long loanId, final Long loanProductId, final Long officeId, final String currencyCode,
|
||||
final boolean cashBasedAccountingEnabled, final boolean upfrontAccrualBasedAccountingEnabled,
|
||||
final boolean periodicAccrualBasedAccountingEnabled, final List<LoanTransactionDTO> newLoanTransactions) {
|
||||
this.loanId = loanId;
|
||||
this.loanProductId = loanProductId;
|
||||
this.officeId = officeId;
|
||||
this.cashBasedAccountingEnabled = cashBasedAccountingEnabled;
|
||||
this.newLoanTransactions = newLoanTransactions;
|
||||
this.currencyCode = currencyCode;
|
||||
this.upfrontAccrualBasedAccountingEnabled = upfrontAccrualBasedAccountingEnabled;
|
||||
this.periodicAccrualBasedAccountingEnabled = periodicAccrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public Long getLoanId() {
|
||||
return this.loanId;
|
||||
}
|
||||
|
||||
public void setLoanId(final Long loanId) {
|
||||
this.loanId = loanId;
|
||||
}
|
||||
|
||||
public Long getLoanProductId() {
|
||||
return this.loanProductId;
|
||||
}
|
||||
|
||||
public void setLoanProductId(final Long loanProductId) {
|
||||
this.loanProductId = loanProductId;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public void setOfficeId(final Long officeId) {
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
public boolean isCashBasedAccountingEnabled() {
|
||||
return this.cashBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public void setCashBasedAccountingEnabled(final boolean cashBasedAccountingEnabled) {
|
||||
this.cashBasedAccountingEnabled = cashBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public boolean isUpfrontAccrualBasedAccountingEnabled() {
|
||||
return this.upfrontAccrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public boolean isPeriodicAccrualBasedAccountingEnabled() {
|
||||
return this.periodicAccrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public List<LoanTransactionDTO> getNewLoanTransactions() {
|
||||
return this.newLoanTransactions;
|
||||
}
|
||||
|
||||
public void setNewLoanTransactions(final List<LoanTransactionDTO> newLoanTransactions) {
|
||||
this.newLoanTransactions = newLoanTransactions;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
|
||||
public void setCurrencyCode(final String currencyCode) {
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+7
-91
@@ -21,15 +21,19 @@ package org.apache.fineract.accounting.journalentry.data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionEnumData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class LoanTransactionDTO {
|
||||
|
||||
private final Long officeId;
|
||||
|
||||
private final Long paymentTypeId;
|
||||
private final String transactionId;
|
||||
private final Date transactionDate;
|
||||
private final Long paymentTypeId;
|
||||
private final LoanTransactionEnumData transactionType;
|
||||
|
||||
private final BigDecimal amount;
|
||||
@@ -50,94 +54,6 @@ public class LoanTransactionDTO {
|
||||
|
||||
private final boolean isAccountTransfer;
|
||||
|
||||
@Setter
|
||||
private boolean isLoanToLoanTransfer;
|
||||
|
||||
public LoanTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate,
|
||||
final LoanTransactionEnumData transactionType, final BigDecimal amount, final BigDecimal principal, final BigDecimal interest,
|
||||
final BigDecimal fees, final BigDecimal penalties, final BigDecimal overPayment, final boolean reversed,
|
||||
final List<ChargePaymentDTO> feePayments, final List<ChargePaymentDTO> penaltyPayments, boolean isAccountTransfer) {
|
||||
this.paymentTypeId = paymentTypeId;
|
||||
this.transactionId = transactionId;
|
||||
this.transactionDate = transactionDate;
|
||||
this.amount = amount;
|
||||
this.principal = principal;
|
||||
this.interest = interest;
|
||||
this.fees = fees;
|
||||
this.penalties = penalties;
|
||||
this.reversed = reversed;
|
||||
this.transactionType = transactionType;
|
||||
this.feePayments = feePayments;
|
||||
this.penaltyPayments = penaltyPayments;
|
||||
this.overPayment = overPayment;
|
||||
this.officeId = officeId;
|
||||
this.isAccountTransfer = isAccountTransfer;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public String getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
return this.transactionDate;
|
||||
}
|
||||
|
||||
public LoanTransactionEnumData getTransactionType() {
|
||||
return this.transactionType;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public BigDecimal getPrincipal() {
|
||||
return this.principal;
|
||||
}
|
||||
|
||||
public BigDecimal getInterest() {
|
||||
return this.interest;
|
||||
}
|
||||
|
||||
public BigDecimal getFees() {
|
||||
return this.fees;
|
||||
}
|
||||
|
||||
public BigDecimal getPenalties() {
|
||||
return this.penalties;
|
||||
}
|
||||
|
||||
public BigDecimal getOverPayment() {
|
||||
return this.overPayment;
|
||||
}
|
||||
|
||||
public boolean isReversed() {
|
||||
return this.reversed;
|
||||
}
|
||||
|
||||
public Long getPaymentTypeId() {
|
||||
return this.paymentTypeId;
|
||||
}
|
||||
|
||||
public List<ChargePaymentDTO> getPenaltyPayments() {
|
||||
return this.penaltyPayments;
|
||||
}
|
||||
|
||||
public List<ChargePaymentDTO> getFeePayments() {
|
||||
return this.feePayments;
|
||||
}
|
||||
|
||||
public boolean isAccountTransfer() {
|
||||
return this.isAccountTransfer;
|
||||
}
|
||||
|
||||
public void setIsLoanToLoanTransfer(boolean isLoanToLoanTransfer) {
|
||||
this.isLoanToLoanTransfer = isLoanToLoanTransfer;
|
||||
}
|
||||
|
||||
public boolean isLoanToLoanTransfer() {
|
||||
return this.isLoanToLoanTransfer;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-24
@@ -20,44 +20,24 @@ package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public final class OfficeOpeningBalancesData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long officeId;
|
||||
@SuppressWarnings("unused")
|
||||
private final String officeName;
|
||||
@SuppressWarnings("unused")
|
||||
private final LocalDate transactionDate;
|
||||
@SuppressWarnings("unused")
|
||||
private final GLAccountData contraAccount;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<JournalEntryData> assetAccountOpeningBalances;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<JournalEntryData> liabityAccountOpeningBalances;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<JournalEntryData> incomeAccountOpeningBalances;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<JournalEntryData> equityAccountOpeningBalances;
|
||||
@SuppressWarnings("unused")
|
||||
private final List<JournalEntryData> expenseAccountOpeningBalances;
|
||||
|
||||
private OfficeOpeningBalancesData(final Long officeId, final String officeName, final LocalDate transactionDate,
|
||||
final GLAccountData contraAccount, final List<JournalEntryData> assetAccountOpeningBalances,
|
||||
final List<JournalEntryData> liabityAccountOpeningBalances, final List<JournalEntryData> incomeAccountOpeningBalances,
|
||||
final List<JournalEntryData> equityAccountOpeningBalances, final List<JournalEntryData> expenseAccountOpeningBalances) {
|
||||
this.officeId = officeId;
|
||||
this.officeName = officeName;
|
||||
this.transactionDate = transactionDate;
|
||||
this.contraAccount = contraAccount;
|
||||
this.assetAccountOpeningBalances = assetAccountOpeningBalances;
|
||||
this.liabityAccountOpeningBalances = liabityAccountOpeningBalances;
|
||||
this.incomeAccountOpeningBalances = incomeAccountOpeningBalances;
|
||||
this.equityAccountOpeningBalances = equityAccountOpeningBalances;
|
||||
this.expenseAccountOpeningBalances = expenseAccountOpeningBalances;
|
||||
}
|
||||
|
||||
public static OfficeOpeningBalancesData createNew(final Long officeId, final String officeName, final LocalDate transactionDate,
|
||||
final GLAccountData contraAccount, final List<JournalEntryData> assetAccountOpeningBalances,
|
||||
final List<JournalEntryData> liabityAccountOpeningBalances, final List<JournalEntryData> incomeAccountOpeningBalances,
|
||||
|
||||
+6
-69
@@ -19,7 +19,13 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class SavingsDTO {
|
||||
|
||||
private Long savingsId;
|
||||
@@ -29,73 +35,4 @@ public class SavingsDTO {
|
||||
private boolean cashBasedAccountingEnabled;
|
||||
private boolean accrualBasedAccountingEnabled;
|
||||
private List<SavingsTransactionDTO> newSavingsTransactions;
|
||||
|
||||
public SavingsDTO(final Long savingsId, final Long savingsProductId, final Long officeId, final String currencyCode,
|
||||
final boolean cashBasedAccountingEnabled, final boolean accrualBasedAccountingEnabled,
|
||||
final List<SavingsTransactionDTO> newSavingsTransactions) {
|
||||
this.savingsId = savingsId;
|
||||
this.savingsProductId = savingsProductId;
|
||||
this.officeId = officeId;
|
||||
this.cashBasedAccountingEnabled = cashBasedAccountingEnabled;
|
||||
this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled;
|
||||
this.newSavingsTransactions = newSavingsTransactions;
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
public Long getSavingsId() {
|
||||
return this.savingsId;
|
||||
}
|
||||
|
||||
public void setSavingsId(final Long savingsId) {
|
||||
this.savingsId = savingsId;
|
||||
}
|
||||
|
||||
public Long getSavingsProductId() {
|
||||
return this.savingsProductId;
|
||||
}
|
||||
|
||||
public void setSavingsProductId(final Long savingsProductId) {
|
||||
this.savingsProductId = savingsProductId;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public void setOfficeId(final Long officeId) {
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
public boolean isCashBasedAccountingEnabled() {
|
||||
return this.cashBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public void setCashBasedAccountingEnabled(final boolean cashBasedAccountingEnabled) {
|
||||
this.cashBasedAccountingEnabled = cashBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public boolean isAccrualBasedAccountingEnabled() {
|
||||
return this.accrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public void setAccrualBasedAccountingEnabled(final boolean accrualBasedAccountingEnabled) {
|
||||
this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public List<SavingsTransactionDTO> getNewSavingsTransactions() {
|
||||
return this.newSavingsTransactions;
|
||||
}
|
||||
|
||||
public void setNewSavingsTransactions(final List<SavingsTransactionDTO> newSavingsTransactions) {
|
||||
this.newSavingsTransactions = newSavingsTransactions;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
|
||||
public void setCurrencyCode(final String currencyCode) {
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+8
-72
@@ -21,97 +21,33 @@ package org.apache.fineract.accounting.journalentry.data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class SavingsTransactionDTO {
|
||||
|
||||
private final Long officeId;
|
||||
private final Long paymentTypeId;
|
||||
private final String transactionId;
|
||||
private final Date transactionDate;
|
||||
private final Long paymentTypeId;
|
||||
private final SavingsAccountTransactionEnumData transactionType;
|
||||
|
||||
private final BigDecimal amount;
|
||||
private final BigDecimal overdraftAmount;
|
||||
|
||||
/*** Boolean values determines if the transaction is reversed ***/
|
||||
private final boolean reversed;
|
||||
|
||||
/** Breakdowns of fees and penalties this Transaction pays **/
|
||||
private final List<ChargePaymentDTO> penaltyPayments;
|
||||
private final List<ChargePaymentDTO> feePayments;
|
||||
private final List<TaxPaymentDTO> taxPayments;
|
||||
|
||||
private final List<ChargePaymentDTO> penaltyPayments;
|
||||
private final BigDecimal overdraftAmount;
|
||||
private final boolean isAccountTransfer;
|
||||
|
||||
public SavingsTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate,
|
||||
final SavingsAccountTransactionEnumData transactionType, final BigDecimal amount, final boolean reversed,
|
||||
final List<ChargePaymentDTO> feePayments, final List<ChargePaymentDTO> penaltyPayments, final BigDecimal overdraftAmount,
|
||||
boolean isAccountTransfer, final List<TaxPaymentDTO> taxPayments) {
|
||||
this.paymentTypeId = paymentTypeId;
|
||||
this.transactionId = transactionId;
|
||||
this.transactionDate = transactionDate;
|
||||
this.amount = amount;
|
||||
this.reversed = reversed;
|
||||
this.transactionType = transactionType;
|
||||
this.feePayments = feePayments;
|
||||
this.penaltyPayments = penaltyPayments;
|
||||
this.officeId = officeId;
|
||||
this.overdraftAmount = overdraftAmount;
|
||||
this.isAccountTransfer = isAccountTransfer;
|
||||
this.taxPayments = taxPayments;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public String getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
return this.transactionDate;
|
||||
}
|
||||
|
||||
public Long getPaymentTypeId() {
|
||||
return this.paymentTypeId;
|
||||
}
|
||||
|
||||
public SavingsAccountTransactionEnumData getTransactionType() {
|
||||
return this.transactionType;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public boolean isReversed() {
|
||||
return this.reversed;
|
||||
}
|
||||
|
||||
public List<ChargePaymentDTO> getPenaltyPayments() {
|
||||
return this.penaltyPayments;
|
||||
}
|
||||
|
||||
public List<ChargePaymentDTO> getFeePayments() {
|
||||
return this.feePayments;
|
||||
}
|
||||
|
||||
public BigDecimal getOverdraftAmount() {
|
||||
return this.overdraftAmount;
|
||||
}
|
||||
private final List<TaxPaymentDTO> taxPayments;
|
||||
|
||||
public boolean isOverdraftTransaction() {
|
||||
return this.overdraftAmount != null && this.overdraftAmount.doubleValue() > 0;
|
||||
}
|
||||
|
||||
public boolean isAccountTransfer() {
|
||||
return this.isAccountTransfer;
|
||||
}
|
||||
|
||||
public List<TaxPaymentDTO> getTaxPayments() {
|
||||
return this.taxPayments;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+6
-69
@@ -19,7 +19,13 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
@Setter
|
||||
public class SharesDTO {
|
||||
|
||||
private Long shareAccountId;
|
||||
@@ -29,73 +35,4 @@ public class SharesDTO {
|
||||
private boolean cashBasedAccountingEnabled;
|
||||
private boolean accrualBasedAccountingEnabled;
|
||||
private List<SharesTransactionDTO> newTransactions;
|
||||
|
||||
public SharesDTO(final Long shareAccountId, final Long shareProductId, final Long officeId, final String currencyCode,
|
||||
final boolean cashBasedAccountingEnabled, final boolean accrualBasedAccountingEnabled,
|
||||
final List<SharesTransactionDTO> newTransactions) {
|
||||
this.shareAccountId = shareAccountId;
|
||||
this.shareProductId = shareProductId;
|
||||
this.officeId = officeId;
|
||||
this.cashBasedAccountingEnabled = cashBasedAccountingEnabled;
|
||||
this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled;
|
||||
this.newTransactions = newTransactions;
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public void setOfficeId(final Long officeId) {
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
public boolean isCashBasedAccountingEnabled() {
|
||||
return this.cashBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public void setCashBasedAccountingEnabled(final boolean cashBasedAccountingEnabled) {
|
||||
this.cashBasedAccountingEnabled = cashBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public boolean isAccrualBasedAccountingEnabled() {
|
||||
return this.accrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public void setAccrualBasedAccountingEnabled(final boolean accrualBasedAccountingEnabled) {
|
||||
this.accrualBasedAccountingEnabled = accrualBasedAccountingEnabled;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
|
||||
public void setCurrencyCode(final String currencyCode) {
|
||||
this.currencyCode = currencyCode;
|
||||
}
|
||||
|
||||
public Long getShareAccountId() {
|
||||
return this.shareAccountId;
|
||||
}
|
||||
|
||||
public void setShareAccountId(Long shareAccountId) {
|
||||
this.shareAccountId = shareAccountId;
|
||||
}
|
||||
|
||||
public Long getShareProductId() {
|
||||
return this.shareProductId;
|
||||
}
|
||||
|
||||
public void setShareProductId(Long shareProductId) {
|
||||
this.shareProductId = shareProductId;
|
||||
}
|
||||
|
||||
public List<SharesTransactionDTO> getNewTransactions() {
|
||||
return this.newTransactions;
|
||||
}
|
||||
|
||||
public void setNewTransactions(List<SharesTransactionDTO> newTransactions) {
|
||||
this.newTransactions = newTransactions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-52
@@ -21,14 +21,18 @@ package org.apache.fineract.accounting.journalentry.data;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountTransactionEnumData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class SharesTransactionDTO {
|
||||
|
||||
private final Long officeId;
|
||||
private final Long paymentTypeId;
|
||||
private final String transactionId;
|
||||
private final Date transactionDate;
|
||||
private final Long paymentTypeId;
|
||||
private final ShareAccountTransactionEnumData transactionType;
|
||||
private final ShareAccountTransactionEnumData transactionStatus;
|
||||
|
||||
@@ -39,55 +43,4 @@ public class SharesTransactionDTO {
|
||||
|
||||
/** Breakdowns of fees and penalties this Transaction pays **/
|
||||
private final List<ChargePaymentDTO> feePayments;
|
||||
|
||||
public SharesTransactionDTO(final Long officeId, final Long paymentTypeId, final String transactionId, final Date transactionDate,
|
||||
final ShareAccountTransactionEnumData transactionType, ShareAccountTransactionEnumData transactionStatus,
|
||||
final BigDecimal amount, final BigDecimal chargeAmount, final List<ChargePaymentDTO> feePayments) {
|
||||
this.paymentTypeId = paymentTypeId;
|
||||
this.transactionId = transactionId;
|
||||
this.transactionDate = transactionDate;
|
||||
this.amount = amount;
|
||||
this.chargeAmount = chargeAmount;
|
||||
this.transactionType = transactionType;
|
||||
this.transactionStatus = transactionStatus;
|
||||
this.feePayments = feePayments;
|
||||
this.officeId = officeId;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public String getTransactionId() {
|
||||
return this.transactionId;
|
||||
}
|
||||
|
||||
public Date getTransactionDate() {
|
||||
return this.transactionDate;
|
||||
}
|
||||
|
||||
public Long getPaymentTypeId() {
|
||||
return this.paymentTypeId;
|
||||
}
|
||||
|
||||
public ShareAccountTransactionEnumData getTransactionType() {
|
||||
return this.transactionType;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
public List<ChargePaymentDTO> getFeePayments() {
|
||||
return this.feePayments;
|
||||
}
|
||||
|
||||
public ShareAccountTransactionEnumData getTransactionStatus() {
|
||||
return this.transactionStatus;
|
||||
}
|
||||
|
||||
public BigDecimal getChargeAmount() {
|
||||
return this.chargeAmount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-20
@@ -19,29 +19,14 @@
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class TaxPaymentDTO {
|
||||
|
||||
private final Long creditAccountId;
|
||||
private final Long debitAccountId;
|
||||
private final Long creditAccountId;
|
||||
private final BigDecimal amount;
|
||||
|
||||
public TaxPaymentDTO(final Long debitAccountId, final Long creditAccountId, final BigDecimal amount) {
|
||||
this.debitAccountId = debitAccountId;
|
||||
this.creditAccountId = creditAccountId;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public Long getCreditAccountId() {
|
||||
return this.creditAccountId;
|
||||
}
|
||||
|
||||
public Long getDebitAccountId() {
|
||||
return this.debitAccountId;
|
||||
}
|
||||
|
||||
public BigDecimal getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-16
@@ -18,21 +18,18 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.portfolio.note.data.NoteData;
|
||||
import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class TransactionDetailData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long transactionId;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final PaymentDetailData paymentDetails;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final NoteData noteData;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final TransactionTypeEnumData transactionType;
|
||||
|
||||
public TransactionDetailData(final Long transactionId, final PaymentDetailData paymentDetails, final NoteData noteData) {
|
||||
@@ -40,14 +37,5 @@ public class TransactionDetailData {
|
||||
this.paymentDetails = paymentDetails;
|
||||
this.noteData = noteData;
|
||||
this.transactionType = null;
|
||||
|
||||
}
|
||||
|
||||
public TransactionDetailData(final Long transactionId, final PaymentDetailData paymentDetails, final NoteData noteData,
|
||||
final TransactionTypeEnumData transactionType) {
|
||||
this.transactionId = transactionId;
|
||||
this.paymentDetails = paymentDetails;
|
||||
this.noteData = noteData;
|
||||
this.transactionType = transactionType;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-12
@@ -18,24 +18,17 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* Immutable data object represent loan and Savings status enumerations.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class TransactionTypeEnumData {
|
||||
|
||||
private final Long id;
|
||||
private final String code;
|
||||
private final String value;
|
||||
|
||||
public TransactionTypeEnumData(final Long id, final String code, final String value) {
|
||||
this.id = id;
|
||||
this.code = code;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Long id() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "JOURNALENTRY", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateJournalEntryCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final JournalEntryWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateJournalEntryCommandHandler(final JournalEntryWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,25 +18,21 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "JOURNALENTRY", action = "DEFINEOPENINGBALANCE")
|
||||
@RequiredArgsConstructor
|
||||
public class DefineOpeningBalanceCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final JournalEntryWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public DefineOpeningBalanceCommandHandler(final JournalEntryWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(JsonCommand command) {
|
||||
return this.writePlatformService.defineOpeningBalance(command);
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "JOURNALENTRY", action = "REVERSE")
|
||||
@RequiredArgsConstructor
|
||||
public class ReverseJournalEntryCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final JournalEntryWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public ReverseJournalEntryCommandHandler(final JournalEntryWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,25 +18,21 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.service.JournalEntryRunningBalanceUpdateService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "JOURNALENTRY", action = "UPDATERUNNINGBALANCE")
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateRunningBalanceCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final JournalEntryRunningBalanceUpdateService journalEntryRunningBalanceUpdateService;
|
||||
|
||||
@Autowired
|
||||
public UpdateRunningBalanceCommandHandler(final JournalEntryRunningBalanceUpdateService journalEntryRunningBalanceUpdateService) {
|
||||
this.journalEntryRunningBalanceUpdateService = journalEntryRunningBalanceUpdateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(JsonCommand command) {
|
||||
return journalEntryRunningBalanceUpdateService.updateOfficeRunningBalance(command);
|
||||
|
||||
+5
-9
@@ -29,6 +29,7 @@ import java.util.HashSet;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams;
|
||||
import org.apache.fineract.accounting.journalentry.command.JournalEntryCommand;
|
||||
@@ -37,22 +38,17 @@ import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.AbstractFromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromApiJsonDeserializer;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Implementation of {@link FromApiJsonDeserializer} for {@link JournalEntryCommand}'s.
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFromApiJsonDeserializer<JournalEntryCommand> {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public JournalEntryCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonfromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonfromApiJsonHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JournalEntryCommand commandFromApiJson(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
@@ -102,8 +98,8 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr
|
||||
debits = populateCreditsOrDebitsArray(topLevelJsonElement, locale, debits, JournalEntryJsonInputParams.DEBITS.getValue());
|
||||
}
|
||||
}
|
||||
return new JournalEntryCommand(officeId, currencyCode, transactionDate, comments, credits, debits, referenceNumber,
|
||||
accountingRuleId, amount, paymentTypeId, accountNumber, checkNumber, receiptNumber, bankNumber, routingCode);
|
||||
return new JournalEntryCommand(officeId, currencyCode, transactionDate, comments, referenceNumber, accountingRuleId, amount,
|
||||
paymentTypeId, accountNumber, checkNumber, receiptNumber, bankNumber, routingCode, credits, debits);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -124,7 +120,7 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr
|
||||
final String comments = this.fromApiJsonHelper.extractStringNamed("comments", creditElement);
|
||||
final BigDecimal amount = this.fromApiJsonHelper.extractBigDecimalNamed("amount", creditElement, locale);
|
||||
|
||||
debitOrCredits[i] = new SingleDebitOrCreditEntryCommand(parametersPassedInForCreditsCommand, glAccountId, amount, comments);
|
||||
debitOrCredits[i] = new SingleDebitOrCreditEntryCommand(glAccountId, amount, comments, parametersPassedInForCreditsCommand);
|
||||
}
|
||||
return debitOrCredits;
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,21 +18,17 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingProcessorForLoanFactory {
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
public AccountingProcessorForLoanFactory(final ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public AccountingProcessorForLoan determineProcessor(final LoanDTO loanDTO) {
|
||||
|
||||
AccountingProcessorForLoan accountingProcessorForLoan = null;
|
||||
|
||||
+2
-6
@@ -18,21 +18,17 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.data.SavingsDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingProcessorForSavingsFactory {
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
public AccountingProcessorForSavingsFactory(final ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/***
|
||||
* Looks like overkill for now, but wanted to keep the savings side of accounting identical to that of Loans (would
|
||||
* we need an Accrual based accounting in the future?)
|
||||
|
||||
+2
-6
@@ -18,21 +18,17 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.journalentry.data.SharesDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingProcessorForSharesFactory {
|
||||
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
public AccountingProcessorForSharesFactory(final ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public AccountingProcessorForShares determineProcessor(final SharesDTO sharesDTO) {
|
||||
|
||||
AccountingProcessorForShares accountingProcessorForShares = null;
|
||||
|
||||
+9
-36
@@ -26,6 +26,7 @@ import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosureRepository;
|
||||
@@ -75,14 +76,11 @@ import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumD
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
|
||||
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransactionRepository;
|
||||
import org.apache.fineract.portfolio.shareaccounts.data.ShareAccountTransactionEnumData;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingProcessorHelper {
|
||||
|
||||
public static final String LOAN_TRANSACTION_IDENTIFIER = "L";
|
||||
@@ -90,6 +88,7 @@ public class AccountingProcessorHelper {
|
||||
public static final String CLIENT_TRANSACTION_IDENTIFIER = "C";
|
||||
public static final String PROVISIONING_TRANSACTION_IDENTIFIER = "P";
|
||||
public static final String SHARE_TRANSACTION_IDENTIFIER = "SH";
|
||||
|
||||
private final JournalEntryRepository glJournalEntryRepository;
|
||||
private final ProductToGLAccountMappingRepository accountMappingRepository;
|
||||
private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository;
|
||||
@@ -101,32 +100,6 @@ public class AccountingProcessorHelper {
|
||||
private final SavingsAccountTransactionRepository savingsAccountTransactionRepository;
|
||||
private final AccountTransfersReadPlatformService accountTransfersReadPlatformService;
|
||||
private final ChargeRepositoryWrapper chargeRepositoryWrapper;
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AccountingProcessorHelper.class);
|
||||
|
||||
@Autowired
|
||||
public AccountingProcessorHelper(final JournalEntryRepository glJournalEntryRepository,
|
||||
final ProductToGLAccountMappingRepository accountMappingRepository, final GLClosureRepository closureRepository,
|
||||
final OfficeRepositoryWrapper officeRepositoryWrapper, final LoanTransactionRepository loanTransactionRepository,
|
||||
final SavingsAccountTransactionRepository savingsAccountTransactionRepository,
|
||||
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository,
|
||||
final AccountTransfersReadPlatformService accountTransfersReadPlatformService,
|
||||
final GLAccountRepositoryWrapper accountRepositoryWrapper,
|
||||
final ClientTransactionRepositoryWrapper clientTransactionRepositoryWrapper,
|
||||
final ChargeRepositoryWrapper chargeRepositoryWrapper, final JdbcTemplate jdbcTemplate) {
|
||||
this.glJournalEntryRepository = glJournalEntryRepository;
|
||||
this.accountMappingRepository = accountMappingRepository;
|
||||
this.closureRepository = closureRepository;
|
||||
this.officeRepositoryWrapper = officeRepositoryWrapper;
|
||||
this.loanTransactionRepository = loanTransactionRepository;
|
||||
this.savingsAccountTransactionRepository = savingsAccountTransactionRepository;
|
||||
this.financialActivityAccountRepository = financialActivityAccountRepository;
|
||||
this.accountTransfersReadPlatformService = accountTransfersReadPlatformService;
|
||||
this.accountRepositoryWrapper = accountRepositoryWrapper;
|
||||
this.clientTransactionRepository = clientTransactionRepositoryWrapper;
|
||||
this.chargeRepositoryWrapper = chargeRepositoryWrapper;
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
public LoanDTO populateLoanDtoFromMap(final Map<String, Object> accountingBridgeData, final boolean cashBasedAccountingEnabled,
|
||||
final boolean upfrontAccrualBasedAccountingEnabled, final boolean periodicAccrualBasedAccountingEnabled) {
|
||||
@@ -165,7 +138,7 @@ public class AccountingProcessorHelper {
|
||||
final Long loanChargeId = (Long) loanChargePaid.get("loanChargeId");
|
||||
final boolean isPenalty = (Boolean) loanChargePaid.get("isPenalty");
|
||||
final BigDecimal chargeAmountPaid = (BigDecimal) loanChargePaid.get("amount");
|
||||
final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, loanChargeId, chargeAmountPaid);
|
||||
final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, chargeAmountPaid, loanChargeId);
|
||||
if (isPenalty) {
|
||||
penaltyPaymentDetails.add(chargePaymentDTO);
|
||||
} else {
|
||||
@@ -180,12 +153,12 @@ public class AccountingProcessorHelper {
|
||||
}
|
||||
final LoanTransactionDTO transaction = new LoanTransactionDTO(transactionOfficeId, paymentTypeId, transactionId,
|
||||
transactionDate, transactionType, amount, principal, interest, fees, penalties, overPayments, reversed,
|
||||
feePaymentDetails, penaltyPaymentDetails, isAccountTransfer);
|
||||
penaltyPaymentDetails, feePaymentDetails, isAccountTransfer);
|
||||
Boolean isLoanToLoanTransfer = (Boolean) accountingBridgeData.get("isLoanToLoanTransfer");
|
||||
if (isLoanToLoanTransfer != null && isLoanToLoanTransfer) {
|
||||
transaction.setIsLoanToLoanTransfer(true);
|
||||
transaction.setLoanToLoanTransfer(true);
|
||||
} else {
|
||||
transaction.setIsLoanToLoanTransfer(false);
|
||||
transaction.setLoanToLoanTransfer(false);
|
||||
}
|
||||
newLoanTransactions.add(transaction);
|
||||
|
||||
@@ -228,7 +201,7 @@ public class AccountingProcessorHelper {
|
||||
final Long loanChargeId = (Long) loanChargePaid.get("savingsChargeId");
|
||||
final boolean isPenalty = (Boolean) loanChargePaid.get("isPenalty");
|
||||
final BigDecimal chargeAmountPaid = (BigDecimal) loanChargePaid.get("amount");
|
||||
final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, loanChargeId, chargeAmountPaid);
|
||||
final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, chargeAmountPaid, loanChargeId);
|
||||
if (isPenalty) {
|
||||
penaltyPayments.add(chargePaymentDTO);
|
||||
} else {
|
||||
@@ -295,7 +268,7 @@ public class AccountingProcessorHelper {
|
||||
final Long chargeId = (Long) chargePaid.get("chargeId");
|
||||
final Long loanChargeId = (Long) chargePaid.get("sharesChargeId");
|
||||
final BigDecimal chargeAmountPaid = (BigDecimal) chargePaid.get("amount");
|
||||
final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, loanChargeId, chargeAmountPaid);
|
||||
final ChargePaymentDTO chargePaymentDTO = new ChargePaymentDTO(chargeId, chargeAmountPaid, loanChargeId);
|
||||
feePayments.add(chargePaymentDTO);
|
||||
}
|
||||
}
|
||||
|
||||
+8
-10
@@ -24,6 +24,7 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
@@ -33,19 +34,14 @@ import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanTransactionDTO;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AccrualBasedAccountingProcessorForLoan implements AccountingProcessorForLoan {
|
||||
|
||||
private final AccountingProcessorHelper helper;
|
||||
|
||||
@Autowired
|
||||
public AccrualBasedAccountingProcessorForLoan(final AccountingProcessorHelper accountingProcessorHelper) {
|
||||
this.helper = accountingProcessorHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createJournalEntriesForLoan(final LoanDTO loanDTO) {
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(loanDTO.getOfficeId());
|
||||
@@ -439,9 +435,10 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
|
||||
|
||||
for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getFeePayments()) {
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(),
|
||||
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1))
|
||||
: chargePaymentDTO.getAmount()));
|
||||
: chargePaymentDTO.getAmount(),
|
||||
chargePaymentDTO.getLoanChargeId()));
|
||||
}
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
@@ -453,9 +450,10 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
|
||||
|
||||
for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getPenaltyPayments()) {
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(),
|
||||
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1))
|
||||
: chargePaymentDTO.getAmount()));
|
||||
: chargePaymentDTO.getAmount(),
|
||||
chargePaymentDTO.getLoanChargeId()));
|
||||
}
|
||||
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
|
||||
+4
-8
@@ -20,25 +20,21 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.journalentry.data.ClientTransactionDTO;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CashBasedAccountingProcessorForClientTransactions implements AccountingProcessorForClientTransactions {
|
||||
|
||||
AccountingProcessorHelper helper;
|
||||
|
||||
@Autowired
|
||||
public CashBasedAccountingProcessorForClientTransactions(final AccountingProcessorHelper accountingProcessorHelper) {
|
||||
this.helper = accountingProcessorHelper;
|
||||
}
|
||||
private final AccountingProcessorHelper helper;
|
||||
|
||||
@Override
|
||||
public void createJournalEntriesForClientTransaction(ClientTransactionDTO clientTransactionDTO) {
|
||||
if (clientTransactionDTO.getAccountingEnabled()) {
|
||||
if (clientTransactionDTO.isAccountingEnabled()) {
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(clientTransactionDTO.getOfficeId());
|
||||
final Date transactionDate = clientTransactionDTO.getTransactionDate();
|
||||
final Office office = this.helper.getOfficeById(clientTransactionDTO.getOfficeId());
|
||||
|
||||
+8
-10
@@ -22,6 +22,7 @@ import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
@@ -29,19 +30,14 @@ import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.LoanTransactionDTO;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CashBasedAccountingProcessorForLoan implements AccountingProcessorForLoan {
|
||||
|
||||
private final AccountingProcessorHelper helper;
|
||||
|
||||
@Autowired
|
||||
public CashBasedAccountingProcessorForLoan(final AccountingProcessorHelper accountingProcessorHelper) {
|
||||
this.helper = accountingProcessorHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createJournalEntriesForLoan(final LoanDTO loanDTO) {
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(loanDTO.getOfficeId());
|
||||
@@ -348,9 +344,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
|
||||
|
||||
for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getFeePayments()) {
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(),
|
||||
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1))
|
||||
: chargePaymentDTO.getAmount()));
|
||||
: chargePaymentDTO.getAmount(),
|
||||
chargePaymentDTO.getLoanChargeId()));
|
||||
}
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
CashAccountsForLoan.INCOME_FROM_FEES.getValue(), loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
@@ -362,9 +359,10 @@ public class CashBasedAccountingProcessorForLoan implements AccountingProcessorF
|
||||
List<ChargePaymentDTO> chargePaymentDTOs = new ArrayList<>();
|
||||
|
||||
for (ChargePaymentDTO chargePaymentDTO : loanTransactionDTO.getPenaltyPayments()) {
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(), chargePaymentDTO.getLoanChargeId(),
|
||||
chargePaymentDTOs.add(new ChargePaymentDTO(chargePaymentDTO.getChargeId(),
|
||||
chargePaymentDTO.getAmount().floatValue() < 0 ? chargePaymentDTO.getAmount().multiply(new BigDecimal(-1))
|
||||
: chargePaymentDTO.getAmount()));
|
||||
: chargePaymentDTO.getAmount(),
|
||||
chargePaymentDTO.getLoanChargeId()));
|
||||
}
|
||||
|
||||
this.helper.createCreditJournalEntryOrReversalForLoanCharges(office, currencyCode,
|
||||
|
||||
+2
-6
@@ -21,6 +21,7 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
||||
@@ -28,19 +29,14 @@ import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SavingsDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SavingsTransactionDTO;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CashBasedAccountingProcessorForSavings implements AccountingProcessorForSavings {
|
||||
|
||||
private final AccountingProcessorHelper helper;
|
||||
|
||||
@Autowired
|
||||
public CashBasedAccountingProcessorForSavings(final AccountingProcessorHelper accountingProcessorHelper) {
|
||||
this.helper = accountingProcessorHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createJournalEntriesForSavings(final SavingsDTO savingsDTO) {
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(savingsDTO.getOfficeId());
|
||||
|
||||
+2
-6
@@ -21,25 +21,21 @@ package org.apache.fineract.accounting.journalentry.service;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForShares;
|
||||
import org.apache.fineract.accounting.journalentry.data.ChargePaymentDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SharesDTO;
|
||||
import org.apache.fineract.accounting.journalentry.data.SharesTransactionDTO;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CashBasedAccountingProcessorForShares implements AccountingProcessorForShares {
|
||||
|
||||
private final AccountingProcessorHelper helper;
|
||||
|
||||
@Autowired
|
||||
public CashBasedAccountingProcessorForShares(final AccountingProcessorHelper helper) {
|
||||
this.helper = helper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createJournalEntriesForShares(SharesDTO sharesDTO) {
|
||||
final GLClosure latestGLClosure = this.helper.getLatestClosureByBranch(sharesDTO.getOfficeId());
|
||||
|
||||
+2
-16
@@ -28,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingEnumerations;
|
||||
import org.apache.fineract.accounting.financialactivityaccount.domain.FinancialActivityAccount;
|
||||
@@ -61,7 +62,6 @@ import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData;
|
||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumData;
|
||||
import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
@@ -69,6 +69,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
@@ -80,21 +81,6 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
||||
private final PaginationHelper paginationHelper;
|
||||
private final DatabaseSpecificSQLGenerator sqlGenerator;
|
||||
|
||||
@Autowired
|
||||
public JournalEntryReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate,
|
||||
final GLAccountReadPlatformService glAccountReadPlatformService, final ColumnValidator columnValidator,
|
||||
final OfficeReadPlatformService officeReadPlatformService,
|
||||
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper,
|
||||
DatabaseSpecificSQLGenerator sqlGenerator, PaginationHelper paginationHelper) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
||||
this.officeReadPlatformService = officeReadPlatformService;
|
||||
this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper;
|
||||
this.columnValidator = columnValidator;
|
||||
this.paginationHelper = paginationHelper;
|
||||
this.sqlGenerator = sqlGenerator;
|
||||
}
|
||||
|
||||
private static final class GLJournalEntryMapper implements RowMapper<JournalEntryData> {
|
||||
|
||||
private final JournalEntryAssociationParametersData associationParametersData;
|
||||
|
||||
+6
-18
@@ -26,6 +26,8 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.accounting.common.AccountingEnumerations;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||
import org.apache.fineract.accounting.journalentry.api.JournalEntryJsonInputParams;
|
||||
@@ -42,19 +44,16 @@ import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecific
|
||||
import org.apache.fineract.infrastructure.jobs.annotation.CronTarget;
|
||||
import org.apache.fineract.infrastructure.jobs.service.JobName;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntryRunningBalanceUpdateService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JournalEntryRunningBalanceUpdateServiceImpl.class);
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
private final OfficeRepositoryWrapper officeRepositoryWrapper;
|
||||
@@ -66,17 +65,6 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
|
||||
private final GLJournalEntryMapper entryMapper = new GLJournalEntryMapper();
|
||||
|
||||
@Autowired
|
||||
public JournalEntryRunningBalanceUpdateServiceImpl(final JdbcTemplate jdbcTemplate,
|
||||
final OfficeRepositoryWrapper officeRepositoryWrapper, final JournalEntryDataValidator dataValidator,
|
||||
final FromJsonHelper fromApiJsonHelper, DatabaseSpecificSQLGenerator sqlGenerator) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.officeRepositoryWrapper = officeRepositoryWrapper;
|
||||
this.dataValidator = dataValidator;
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
this.sqlGenerator = sqlGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CronTarget(jobName = JobName.ACCOUNTING_RUNNING_BALANCE_UPDATE)
|
||||
public void updateRunningBalance() {
|
||||
@@ -86,7 +74,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class);
|
||||
updateOrganizationRunningBalance(entityDate);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
LOG.debug("No results found for updation of running balance ");
|
||||
log.debug("No results found for updation of running balance ");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +95,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry
|
||||
Date entityDate = this.jdbcTemplate.queryForObject(dateFinder, Date.class, officeId);
|
||||
updateRunningBalance(officeId, entityDate);
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
LOG.debug("No results found for updation of office running balance with office id: {}", officeId);
|
||||
log.debug("No results found for updation of office running balance with office id: {}", officeId);
|
||||
}
|
||||
commandProcessingResultBuilder.withOfficeId(officeId);
|
||||
}
|
||||
|
||||
+5
-37
@@ -30,6 +30,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosure;
|
||||
import org.apache.fineract.accounting.closure.domain.GLClosureRepository;
|
||||
@@ -78,9 +80,6 @@ import org.apache.fineract.portfolio.client.domain.ClientTransaction;
|
||||
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
@@ -89,10 +88,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements JournalEntryWritePlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(JournalEntryWritePlatformServiceJpaRepositoryImpl.class);
|
||||
|
||||
private final GLClosureRepository glClosureRepository;
|
||||
private final GLAccountRepository glAccountRepository;
|
||||
private final JournalEntryRepository glJournalEntryRepository;
|
||||
@@ -110,37 +109,6 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
private final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper;
|
||||
private final CashBasedAccountingProcessorForClientTransactions accountingProcessorForClientTransactions;
|
||||
|
||||
@Autowired
|
||||
public JournalEntryWritePlatformServiceJpaRepositoryImpl(final GLClosureRepository glClosureRepository,
|
||||
final JournalEntryRepository glJournalEntryRepository, final OfficeRepositoryWrapper officeRepositoryWrapper,
|
||||
final GLAccountRepository glAccountRepository, final JournalEntryCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
||||
final AccountingProcessorHelper accountingProcessorHelper, final AccountingRuleRepository accountingRuleRepository,
|
||||
final AccountingProcessorForLoanFactory accountingProcessorForLoanFactory,
|
||||
final AccountingProcessorForSavingsFactory accountingProcessorForSavingsFactory,
|
||||
final AccountingProcessorForSharesFactory accountingProcessorForSharesFactory,
|
||||
final GLAccountReadPlatformService glAccountReadPlatformService,
|
||||
final OrganisationCurrencyRepositoryWrapper organisationCurrencyRepository, final PlatformSecurityContext context,
|
||||
final PaymentDetailWritePlatformService paymentDetailWritePlatformService,
|
||||
final FinancialActivityAccountRepositoryWrapper financialActivityAccountRepositoryWrapper,
|
||||
final CashBasedAccountingProcessorForClientTransactions accountingProcessorForClientTransactions) {
|
||||
this.glClosureRepository = glClosureRepository;
|
||||
this.officeRepositoryWrapper = officeRepositoryWrapper;
|
||||
this.glJournalEntryRepository = glJournalEntryRepository;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
this.glAccountRepository = glAccountRepository;
|
||||
this.accountingProcessorForLoanFactory = accountingProcessorForLoanFactory;
|
||||
this.accountingProcessorForSavingsFactory = accountingProcessorForSavingsFactory;
|
||||
this.accountingProcessorForSharesFactory = accountingProcessorForSharesFactory;
|
||||
this.helper = accountingProcessorHelper;
|
||||
this.accountingRuleRepository = accountingRuleRepository;
|
||||
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
||||
this.organisationCurrencyRepository = organisationCurrencyRepository;
|
||||
this.context = context;
|
||||
this.paymentDetailWritePlatformService = paymentDetailWritePlatformService;
|
||||
this.financialActivityAccountRepositoryWrapper = financialActivityAccountRepositoryWrapper;
|
||||
this.accountingProcessorForClientTransactions = accountingProcessorForClientTransactions;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult createJournalEntry(final JsonCommand command) {
|
||||
@@ -662,7 +630,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
||||
|
||||
private PlatformDataIntegrityException handleJournalEntryDataIntegrityIssues(final Throwable realCause,
|
||||
final NonTransientDataAccessException dve) {
|
||||
LOG.error("Error occured.", dve);
|
||||
log.error("Error occured.", dve);
|
||||
return new PlatformDataIntegrityException("error.msg.glJournalEntry.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource Journal Entry: " + realCause.getMessage());
|
||||
}
|
||||
|
||||
+4
-8
@@ -19,19 +19,15 @@
|
||||
package org.apache.fineract.accounting.producttoaccountmapping.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class ChargeToGLAccountMapper implements Serializable {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final ChargeData charge;
|
||||
@SuppressWarnings("unused")
|
||||
private final GLAccountData incomeAccount;
|
||||
|
||||
public ChargeToGLAccountMapper(final ChargeData charge, final GLAccountData incomeAccount) {
|
||||
this.charge = charge;
|
||||
this.incomeAccount = incomeAccount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+4
-8
@@ -19,19 +19,15 @@
|
||||
package org.apache.fineract.accounting.producttoaccountmapping.data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class PaymentTypeToGLAccountMapper implements Serializable {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final PaymentTypeData paymentType;
|
||||
@SuppressWarnings("unused")
|
||||
private final GLAccountData fundSourceAccount;
|
||||
|
||||
public PaymentTypeToGLAccountMapper(final PaymentTypeData paymentType, final GLAccountData fundSourceAccount) {
|
||||
this.paymentType = paymentType;
|
||||
this.fundSourceAccount = fundSourceAccount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -26,6 +26,7 @@ import com.google.gson.JsonElement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
||||
@@ -41,7 +42,6 @@ import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
|
||||
import org.apache.fineract.portfolio.savings.DepositAccountType;
|
||||
import org.apache.fineract.portfolio.shareproducts.constants.ShareProductApiConstants;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -65,15 +65,11 @@ import org.springframework.stereotype.Component;
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public ProductToGLAccountMappingFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
|
||||
public void validateForLoanProductCreate(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
throw new InvalidJsonException();
|
||||
|
||||
-2
@@ -34,13 +34,11 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappingHelper {
|
||||
|
||||
@Autowired
|
||||
public LoanProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository,
|
||||
final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper,
|
||||
final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper,
|
||||
|
||||
+3
-16
@@ -27,6 +27,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
@@ -44,33 +45,19 @@ import org.apache.fineract.portfolio.charge.domain.Charge;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.paymenttype.domain.PaymentType;
|
||||
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ProductToGLAccountMappingHelper {
|
||||
|
||||
protected final GLAccountRepository accountRepository;
|
||||
protected final GLAccountRepositoryWrapper accountRepositoryWrapper;
|
||||
protected final ProductToGLAccountMappingRepository accountMappingRepository;
|
||||
protected final FromJsonHelper fromApiJsonHelper;
|
||||
private final ChargeRepositoryWrapper chargeRepositoryWrapper;
|
||||
protected final GLAccountRepositoryWrapper accountRepositoryWrapper;
|
||||
private final PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper;
|
||||
|
||||
@Autowired
|
||||
public ProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository,
|
||||
final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper,
|
||||
final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper,
|
||||
PaymentTypeRepositoryWrapper paymentTypeRepositoryWrapper) {
|
||||
this.accountRepository = glAccountRepository;
|
||||
this.accountMappingRepository = glAccountMappingRepository;
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
this.chargeRepositoryWrapper = chargeRepositoryWrapper;
|
||||
this.accountRepositoryWrapper = accountRepositoryWrapper;
|
||||
this.paymentTypeRepositoryWrapper = paymentTypeRepositoryWrapper;
|
||||
|
||||
}
|
||||
|
||||
public void saveProductToAccountMapping(final JsonElement element, final String paramName, final Long productId,
|
||||
final int placeHolderTypeId, final GLAccountType expectedAccountType, final PortfolioProductType portfolioProductType) {
|
||||
final Long accountId = this.fromApiJsonHelper.extractLongNamed(paramName, element);
|
||||
|
||||
+2
-6
@@ -24,6 +24,7 @@ import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
@@ -39,21 +40,16 @@ import org.apache.fineract.accounting.producttoaccountmapping.domain.PortfolioPr
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.apache.fineract.portfolio.charge.data.ChargeData;
|
||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ProductToGLAccountMappingReadPlatformServiceImpl implements ProductToGLAccountMappingReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Autowired
|
||||
public ProductToGLAccountMappingReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
}
|
||||
|
||||
private static final class ProductToGLAccountMappingMapper implements RowMapper<Map<String, Object>> {
|
||||
|
||||
public String schema() {
|
||||
|
||||
+2
-14
@@ -25,6 +25,7 @@ import com.google.gson.JsonElement;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.AccrualAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForLoan;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants.CashAccountsForSavings;
|
||||
@@ -37,11 +38,11 @@ import org.apache.fineract.accounting.producttoaccountmapping.serialization.Prod
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.savings.DepositAccountType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ProductToGLAccountMappingWritePlatformServiceImpl implements ProductToGLAccountMappingWritePlatformService {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
@@ -50,19 +51,6 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
|
||||
private final SavingsProductToGLAccountMappingHelper savingsProductToGLAccountMappingHelper;
|
||||
private final ShareProductToGLAccountMappingHelper shareProductToGLAccountMappingHelper;
|
||||
|
||||
@Autowired
|
||||
public ProductToGLAccountMappingWritePlatformServiceImpl(final FromJsonHelper fromApiJsonHelper,
|
||||
final ProductToGLAccountMappingFromApiJsonDeserializer deserializer,
|
||||
final LoanProductToGLAccountMappingHelper loanProductToGLAccountMappingHelper,
|
||||
final SavingsProductToGLAccountMappingHelper savingsProductToGLAccountMappingHelper,
|
||||
final ShareProductToGLAccountMappingHelper shareProductToGLAccountMappingHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
this.deserializer = deserializer;
|
||||
this.loanProductToGLAccountMappingHelper = loanProductToGLAccountMappingHelper;
|
||||
this.savingsProductToGLAccountMappingHelper = savingsProductToGLAccountMappingHelper;
|
||||
this.shareProductToGLAccountMappingHelper = shareProductToGLAccountMappingHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void createLoanProductToGLAccountMapping(final Long loanProductId, final JsonCommand command) {
|
||||
|
||||
-2
@@ -33,13 +33,11 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMappingHelper {
|
||||
|
||||
@Autowired
|
||||
public SavingsProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository,
|
||||
final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper,
|
||||
final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper,
|
||||
|
||||
-2
@@ -33,13 +33,11 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
||||
import org.apache.fineract.portfolio.paymenttype.domain.PaymentTypeRepositoryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMappingHelper {
|
||||
|
||||
@Autowired
|
||||
public ShareProductToGLAccountMappingHelper(final GLAccountRepository glAccountRepository,
|
||||
final ProductToGLAccountMappingRepository glAccountMappingRepository, final FromJsonHelper fromApiJsonHelper,
|
||||
final ChargeRepositoryWrapper chargeRepositoryWrapper, final GLAccountRepositoryWrapper accountRepositoryWrapper,
|
||||
|
||||
+7
-19
@@ -40,6 +40,7 @@ import javax.ws.rs.QueryParam;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants;
|
||||
import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData;
|
||||
import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData;
|
||||
@@ -55,7 +56,6 @@ import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSer
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -65,32 +65,20 @@ import org.springframework.stereotype.Component;
|
||||
@Tag(name = "Provisioning Entries", description = "This defines the Provisioning Entries for all active loan products\n" + "\n"
|
||||
+ "Field Descriptions\n" + "date\n" + "Date on which day provisioning entries should be created\n" + "createjournalentries\n"
|
||||
+ "Boolean variable whether to add journal entries for generated provisioning entries\n")
|
||||
@RequiredArgsConstructor
|
||||
public class ProvisioningEntriesApiResource {
|
||||
|
||||
private static final Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM));
|
||||
private static final Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(
|
||||
Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM));
|
||||
|
||||
private final PlatformSecurityContext platformSecurityContext;
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final DefaultToApiJsonSerializer<ProvisioningEntryData> toApiJsonSerializer;
|
||||
private final DefaultToApiJsonSerializer<Object> entriesApiJsonSerializer;
|
||||
private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService;
|
||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||
private static final Set<String> PROVISIONING_ENTRY_PARAMETERS = new HashSet<>(
|
||||
Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM, ProvisioningEntriesApiConstants.ENTRIES_PARAM));
|
||||
private static final Set<String> ALL_PROVISIONING_ENTRIES = new HashSet<>(
|
||||
Arrays.asList(ProvisioningEntriesApiConstants.PROVISIONINGENTRY_PARAM));
|
||||
|
||||
@Autowired
|
||||
public ProvisioningEntriesApiResource(final PlatformSecurityContext platformSecurityContext,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final DefaultToApiJsonSerializer<ProvisioningEntryData> toApiJsonSerializer,
|
||||
final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService,
|
||||
final ApiRequestParameterHelper apiRequestParameterHelper, final DefaultToApiJsonSerializer<Object> entriesApiJsonSerializer) {
|
||||
this.platformSecurityContext = platformSecurityContext;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
||||
this.provisioningEntriesReadPlatformService = provisioningEntriesReadPlatformService;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.entriesApiJsonSerializer = entriesApiJsonSerializer;
|
||||
}
|
||||
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+2
-63
@@ -19,45 +19,29 @@
|
||||
package org.apache.fineract.accounting.provisioning.data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class LoanProductProvisioningEntryData {
|
||||
|
||||
private final Long historyId;
|
||||
|
||||
private final Long officeId;
|
||||
|
||||
private final String officeName;
|
||||
|
||||
private final String currencyCode;
|
||||
|
||||
private final Long productId;
|
||||
|
||||
private final String productName;
|
||||
|
||||
private final Long categoryId;
|
||||
|
||||
private final String categoryName;
|
||||
|
||||
private final Long overdueInDays;
|
||||
|
||||
private final BigDecimal percentage;
|
||||
|
||||
private final BigDecimal balance;
|
||||
|
||||
private final BigDecimal amountreserved;
|
||||
|
||||
private final Long liablityAccount;
|
||||
|
||||
private final String liabilityAccountCode;
|
||||
|
||||
private final String liabilityAccountName;
|
||||
|
||||
private final Long expenseAccount;
|
||||
|
||||
private final String expenseAccountCode;
|
||||
|
||||
private final String expenseAccountName;
|
||||
|
||||
private final Long criteriaId;
|
||||
|
||||
public LoanProductProvisioningEntryData(final Long historyId, final Long officeId, final String currencyCode, final Long productId,
|
||||
@@ -108,49 +92,4 @@ public class LoanProductProvisioningEntryData {
|
||||
this.expenseAccountName = expenseAccountName;
|
||||
this.criteriaId = criteriaId;
|
||||
}
|
||||
|
||||
public Long getHistoryId() {
|
||||
return this.historyId;
|
||||
}
|
||||
|
||||
public Long getOfficeId() {
|
||||
return this.officeId;
|
||||
}
|
||||
|
||||
public Long getProductId() {
|
||||
return this.productId;
|
||||
}
|
||||
|
||||
public Long getCategoryId() {
|
||||
return this.categoryId;
|
||||
}
|
||||
|
||||
public Long getOverdueInDays() {
|
||||
return this.overdueInDays;
|
||||
}
|
||||
|
||||
public BigDecimal getOutstandingBalance() {
|
||||
return balance;
|
||||
}
|
||||
|
||||
public BigDecimal getPercentage() {
|
||||
return percentage;
|
||||
}
|
||||
|
||||
public Long getLiablityAccount() {
|
||||
return this.liablityAccount;
|
||||
}
|
||||
|
||||
public Long getExpenseAccount() {
|
||||
return this.expenseAccount;
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return this.currencyCode;
|
||||
}
|
||||
|
||||
public Long getCriteriaId() {
|
||||
return this.criteriaId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-7
@@ -18,27 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.provisioning.service.ProvisioningEntriesWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "PROVISIONENTRIES", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateProvisioningEntriesRequestCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateProvisioningEntriesRequestCommandHandler(
|
||||
final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) {
|
||||
this.provisioningEntriesWritePlatformService = provisioningEntriesWritePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
|
||||
|
||||
+2
-7
@@ -18,27 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.provisioning.service.ProvisioningEntriesWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "PROVISIONJOURNALENTRIES", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateProvisioningJournalEntriesRequestCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateProvisioningJournalEntriesRequestCommandHandler(
|
||||
final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) {
|
||||
this.provisioningEntriesWritePlatformService = provisioningEntriesWritePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
|
||||
|
||||
+2
-7
@@ -18,27 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.provisioning.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.provisioning.service.ProvisioningEntriesWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "PROVISIONENTRIES", action = "RECREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class ReCreateProvisioningEntryRequestCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService;
|
||||
|
||||
@Autowired
|
||||
public ReCreateProvisioningEntryRequestCommandHandler(
|
||||
final ProvisioningEntriesWritePlatformService provisioningEntriesWritePlatformService) {
|
||||
this.provisioningEntriesWritePlatformService = provisioningEntriesWritePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
|
||||
|
||||
+3
-7
@@ -29,6 +29,7 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.provisioning.constant.ProvisioningEntriesApiConstants;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -37,20 +38,15 @@ import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidati
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
||||
import org.apache.fineract.organisation.provisioning.exception.ProvisioningCriteriaCannotBeCreatedException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ProvisioningEntriesDefinitionJsonDeserializer implements ProvisioningEntriesApiConstants {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
private static final Set<String> supportedParameters = new HashSet<>(
|
||||
Arrays.asList(JSON_DATE_PARAM, JSON_DATEFORMAT_PARAM, JSON_LOCALE_PARAM, JSON_CREATEJOURNALENTRIES_PARAM));
|
||||
|
||||
@Autowired
|
||||
public ProvisioningEntriesDefinitionJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
public void validateForCreate(final String json) {
|
||||
if (StringUtils.isBlank(json)) {
|
||||
|
||||
+5
-14
@@ -26,39 +26,30 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.accounting.provisioning.data.LoanProductProvisioningEntryData;
|
||||
import org.apache.fineract.accounting.provisioning.data.ProvisioningEntryData;
|
||||
import org.apache.fineract.infrastructure.core.service.Page;
|
||||
import org.apache.fineract.infrastructure.core.service.PaginationHelper;
|
||||
import org.apache.fineract.infrastructure.core.service.SearchParameters;
|
||||
import org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningEntriesReadPlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ProvisioningEntriesReadPlatformServiceImpl.class);
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
private final PaginationHelper loanProductProvisioningEntryDataPaginationHelper;
|
||||
private final PaginationHelper provisioningEntryDataPaginationHelper;
|
||||
private final DatabaseSpecificSQLGenerator sqlGenerator;
|
||||
|
||||
@Autowired
|
||||
public ProvisioningEntriesReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate, DatabaseSpecificSQLGenerator sqlGenerator,
|
||||
PaginationHelper paginationHelper) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.loanProductProvisioningEntryDataPaginationHelper = paginationHelper;
|
||||
this.provisioningEntryDataPaginationHelper = paginationHelper;
|
||||
this.sqlGenerator = sqlGenerator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<LoanProductProvisioningEntryData> retrieveLoanProductsProvisioningData(Date date) {
|
||||
String formattedDate = new SimpleDateFormat("yyyy-MM-dd").format(date);
|
||||
@@ -250,7 +241,7 @@ public class ProvisioningEntriesReadPlatformServiceImpl implements ProvisioningE
|
||||
try {
|
||||
data = this.jdbcTemplate.queryForObject(sql1, mapper1, new Object[] { date });
|
||||
} catch (EmptyResultDataAccessException e) {
|
||||
LOG.error("Problem occurred in retrieveProvisioningEntryData function", e);
|
||||
log.error("Problem occurred in retrieveProvisioningEntryData function", e);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
+7
-29
@@ -26,6 +26,8 @@ import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||
import org.apache.fineract.accounting.journalentry.service.JournalEntryWritePlatformService;
|
||||
@@ -60,17 +62,15 @@ import org.apache.fineract.organisation.provisioning.service.ProvisioningCriteri
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
|
||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements ProvisioningEntriesWritePlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl.class);
|
||||
private final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService;
|
||||
private final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService;
|
||||
private final LoanProductRepository loanProductRepository;
|
||||
@@ -83,28 +83,6 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
private final ProvisioningEntriesDefinitionJsonDeserializer fromApiJsonDeserializer;
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl(
|
||||
final ProvisioningEntriesReadPlatformService provisioningEntriesReadPlatformService,
|
||||
final ProvisioningCriteriaReadPlatformService provisioningCriteriaReadPlatformService,
|
||||
final LoanProductRepository loanProductRepository, final GLAccountRepository glAccountRepository,
|
||||
final OfficeRepositoryWrapper officeRepositoryWrapper, final ProvisioningCategoryRepository provisioningCategoryRepository,
|
||||
final PlatformSecurityContext platformSecurityContext, final ProvisioningEntryRepository provisioningEntryRepository,
|
||||
final JournalEntryWritePlatformService journalEntryWritePlatformService,
|
||||
final ProvisioningEntriesDefinitionJsonDeserializer fromApiJsonDeserializer, final FromJsonHelper fromApiJsonHelper) {
|
||||
this.provisioningEntriesReadPlatformService = provisioningEntriesReadPlatformService;
|
||||
this.provisioningCriteriaReadPlatformService = provisioningCriteriaReadPlatformService;
|
||||
this.loanProductRepository = loanProductRepository;
|
||||
this.glAccountRepository = glAccountRepository;
|
||||
this.officeRepositoryWrapper = officeRepositoryWrapper;
|
||||
this.provisioningCategoryRepository = provisioningCategoryRepository;
|
||||
this.platformSecurityContext = platformSecurityContext;
|
||||
this.provisioningEntryRepository = provisioningEntryRepository;
|
||||
this.journalEntryWritePlatformService = journalEntryWritePlatformService;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult createProvisioningJournalEntries(Long provisioningEntryId, JsonCommand command) {
|
||||
ProvisioningEntry requestedEntry = this.provisioningEntryRepository.findById(provisioningEntryId)
|
||||
@@ -169,9 +147,9 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
}
|
||||
createProvsioningEntry(currentDate, addJournalEntries);
|
||||
} catch (ProvisioningEntryAlreadyCreatedException peace) {
|
||||
LOG.error("Provisioning Entry already created", peace);
|
||||
log.error("Provisioning Entry already created", peace);
|
||||
} catch (final JpaSystemException | DataIntegrityViolationException dve) {
|
||||
LOG.error("Problem occurred in generateLoanLossProvisioningAmount function", dve);
|
||||
log.error("Problem occurred in generateLoanLossProvisioningAmount function", dve);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +216,7 @@ public class ProvisioningEntriesWritePlatformServiceJpaRepositoryImpl implements
|
||||
GLAccount liabilityAccount = glAccountRepository.findById(data.getLiablityAccount()).get();
|
||||
GLAccount expenseAccount = glAccountRepository.findById(data.getExpenseAccount()).get();
|
||||
MonetaryCurrency currency = loanProduct.getPrincipalAmount().getCurrency();
|
||||
Money money = Money.of(currency, data.getOutstandingBalance());
|
||||
Money money = Money.of(currency, data.getBalance());
|
||||
Money amountToReserve = money.percentageOf(data.getPercentage(), MoneyHelper.getRoundingMode());
|
||||
Long criteraId = data.getCriteriaId();
|
||||
LoanProductProvisioningEntry entry = new LoanProductProvisioningEntry(loanProduct, office, data.getCurrencyCode(),
|
||||
|
||||
+2
-18
@@ -46,6 +46,7 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingConstants;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService;
|
||||
@@ -66,7 +67,6 @@ import org.apache.fineract.infrastructure.security.service.PlatformSecurityConte
|
||||
import org.apache.fineract.organisation.office.data.OfficeData;
|
||||
import org.apache.fineract.organisation.office.service.OfficeReadPlatformService;
|
||||
import org.apache.fineract.useradministration.domain.AppUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -80,6 +80,7 @@ import org.springframework.stereotype.Component;
|
||||
+ "A Simple journal entry where either credit or debit accounts have been limited to a pre-selected list of accounts (Ex: Debit account should be one of \"Bank of America\" of \"JP Morgan\" and credit account should be \"Cash\")\n"
|
||||
+ "A Compound journal entry where multiple debits and / or multiple credits may be made amongst a set of preselected list of accounts (Ex: Credit account should be either \"Bank Of America\" or \"Cash\" and debit account can be \"Employee Salary\" and/or \"Miscellenous Expenses\")\n"
|
||||
+ "An accounting rule can also be optionally associated with a branch, so that only a particular Branch's users have access to the rule")
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingRuleApiResource {
|
||||
|
||||
private static final Set<String> RESPONSE_DATA_PARAMETERS = new HashSet<>(
|
||||
@@ -98,23 +99,6 @@ public class AccountingRuleApiResource {
|
||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||
private final CodeValueReadPlatformService codeValueReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public AccountingRuleApiResource(final PlatformSecurityContext context,
|
||||
final AccountingRuleReadPlatformService accountingRuleReadPlatformService,
|
||||
final DefaultToApiJsonSerializer<AccountingRuleData> toApiJsonSerializer,
|
||||
final ApiRequestParameterHelper apiRequestParameterHelper, final GLAccountReadPlatformService accountReadPlatformService,
|
||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
|
||||
final OfficeReadPlatformService officeReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService) {
|
||||
this.context = context;
|
||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||
this.apiJsonSerializerService = toApiJsonSerializer;
|
||||
this.accountingRuleReadPlatformService = accountingRuleReadPlatformService;
|
||||
this.officeReadPlatformService = officeReadPlatformService;
|
||||
this.accountReadPlatformService = accountReadPlatformService;
|
||||
this.codeValueReadPlatformService = codeValueReadPlatformService;
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("template")
|
||||
@Consumes({ MediaType.APPLICATION_JSON })
|
||||
|
||||
+4
-13
@@ -18,25 +18,16 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public class AccountingTagRuleData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
private final CodeValueData tag;
|
||||
@SuppressWarnings("unused")
|
||||
private final EnumOptionData transactionType;
|
||||
|
||||
public AccountingTagRuleData(final Long id, final CodeValueData tag, final EnumOptionData transactionType) {
|
||||
this.id = id;
|
||||
this.tag = tag;
|
||||
this.transactionType = transactionType;
|
||||
}
|
||||
|
||||
public CodeValueData getTag() {
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "ACCOUNTINGRULE", action = "CREATE")
|
||||
@RequiredArgsConstructor
|
||||
public class CreateAccountingRuleCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final AccountingRuleWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public CreateAccountingRuleCommandHandler(final AccountingRuleWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "ACCOUNTINGRULE", action = "DELETE")
|
||||
@RequiredArgsConstructor
|
||||
public class DeleteAccountingRuleCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final AccountingRuleWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public DeleteAccountingRuleCommandHandler(final AccountingRuleWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -18,26 +18,22 @@
|
||||
*/
|
||||
package org.apache.fineract.accounting.rule.handler;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.rule.service.AccountingRuleWritePlatformService;
|
||||
import org.apache.fineract.commands.annotation.CommandType;
|
||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@CommandType(entity = "ACCOUNTINGRULE", action = "UPDATE")
|
||||
@RequiredArgsConstructor
|
||||
public class UpdateAccountingRuleCommandHandler implements NewCommandSourceHandler {
|
||||
|
||||
private final AccountingRuleWritePlatformService writePlatformService;
|
||||
|
||||
@Autowired
|
||||
public UpdateAccountingRuleCommandHandler(final AccountingRuleWritePlatformService writePlatformService) {
|
||||
this.writePlatformService = writePlatformService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
||||
|
||||
+2
-6
@@ -25,6 +25,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.rule.api.AccountingRuleJsonInputParams;
|
||||
import org.apache.fineract.infrastructure.core.data.ApiParameterError;
|
||||
@@ -32,11 +33,11 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
|
||||
import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingRuleCommandFromApiJsonDeserializer {
|
||||
|
||||
/**
|
||||
@@ -46,11 +47,6 @@ public class AccountingRuleCommandFromApiJsonDeserializer {
|
||||
|
||||
private final FromJsonHelper fromApiJsonHelper;
|
||||
|
||||
@Autowired
|
||||
public AccountingRuleCommandFromApiJsonDeserializer(final FromJsonHelper fromApiJsonHelper) {
|
||||
this.fromApiJsonHelper = fromApiJsonHelper;
|
||||
}
|
||||
|
||||
public void validateForCreate(final String json) {
|
||||
|
||||
if (StringUtils.isBlank(json)) {
|
||||
|
||||
+2
-8
@@ -25,6 +25,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.accounting.common.AccountingEnumerations;
|
||||
import org.apache.fineract.accounting.glaccount.data.GLAccountDataForLookup;
|
||||
import org.apache.fineract.accounting.glaccount.service.GLAccountReadPlatformService;
|
||||
@@ -35,7 +36,6 @@ import org.apache.fineract.accounting.rule.exception.AccountingRuleNotFoundExcep
|
||||
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -44,18 +44,12 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleReadPlatformService {
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
private final GLAccountReadPlatformService glAccountReadPlatformService;
|
||||
|
||||
@Autowired
|
||||
public AccountingRuleReadPlatformServiceImpl(final JdbcTemplate jdbcTemplate,
|
||||
final GLAccountReadPlatformService glAccountReadPlatformService) {
|
||||
this.jdbcTemplate = jdbcTemplate;
|
||||
this.glAccountReadPlatformService = glAccountReadPlatformService;
|
||||
}
|
||||
|
||||
private static final class AccountingRuleDataExtractor implements ResultSetExtractor<Map<Long, AccountingRuleData>> {
|
||||
|
||||
private final String schemaSql;
|
||||
|
||||
+5
-19
@@ -25,6 +25,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.accounting.closure.api.GLClosureJsonInputParams;
|
||||
import org.apache.fineract.accounting.glaccount.domain.GLAccount;
|
||||
@@ -47,9 +49,6 @@ import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuild
|
||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.office.domain.OfficeRepositoryWrapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
import org.springframework.orm.jpa.JpaSystemException;
|
||||
@@ -57,10 +56,10 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements AccountingRuleWritePlatformService {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AccountingRuleWritePlatformServiceJpaRepositoryImpl.class);
|
||||
|
||||
private final AccountingRuleRepositoryWrapper accountingRuleRepositoryWrapper;
|
||||
private final AccountingRuleRepository accountingRuleRepository;
|
||||
private final GLAccountRepositoryWrapper accountRepositoryWrapper;
|
||||
@@ -68,19 +67,6 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
private final AccountingRuleCommandFromApiJsonDeserializer fromApiJsonDeserializer;
|
||||
private final CodeValueRepository codeValueRepository;
|
||||
|
||||
@Autowired
|
||||
public AccountingRuleWritePlatformServiceJpaRepositoryImpl(final AccountingRuleRepositoryWrapper accountingRuleRepositoryWrapper,
|
||||
final GLAccountRepositoryWrapper accountRepositoryWrapper, final OfficeRepositoryWrapper officeRepositoryWrapper,
|
||||
final AccountingRuleRepository ruleRepository, final AccountingRuleCommandFromApiJsonDeserializer fromApiJsonDeserializer,
|
||||
final CodeValueRepository codeValueRepository) {
|
||||
this.accountRepositoryWrapper = accountRepositoryWrapper;
|
||||
this.officeRepositoryWrapper = officeRepositoryWrapper;
|
||||
this.accountingRuleRepository = ruleRepository;
|
||||
this.accountingRuleRepositoryWrapper = accountingRuleRepositoryWrapper;
|
||||
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
|
||||
this.codeValueRepository = codeValueRepository;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param command
|
||||
* @param dve
|
||||
@@ -93,7 +79,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco
|
||||
throw new AccountingRuleDuplicateException();
|
||||
}
|
||||
|
||||
LOG.error("Error occured.", dve);
|
||||
log.error("Error occured.", dve);
|
||||
throw new PlatformDataIntegrityException("error.msg.accounting.rule.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource Accounting Rule: " + realCause.getMessage());
|
||||
}
|
||||
|
||||
+6
-105
@@ -22,6 +22,8 @@ import java.time.ZonedDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.fineract.adhocquery.domain.ReportRunFrequency;
|
||||
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
|
||||
@@ -29,133 +31,32 @@ import org.apache.fineract.infrastructure.core.data.EnumOptionData;
|
||||
* Immutable data object represent note or case information AdHocData
|
||||
*
|
||||
*/
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class AdHocData {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final Long id;
|
||||
@SuppressWarnings("unused")
|
||||
private final String name;
|
||||
@SuppressWarnings("unused")
|
||||
private final String query;
|
||||
@SuppressWarnings("unused")
|
||||
private final String tableName;
|
||||
@SuppressWarnings("unused")
|
||||
private final String tableFields;
|
||||
@SuppressWarnings("unused")
|
||||
private final String email;
|
||||
@SuppressWarnings("unused")
|
||||
private final boolean isActive;
|
||||
@SuppressWarnings("unused")
|
||||
private final ZonedDateTime createdOn;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long createdById;
|
||||
@SuppressWarnings("unused")
|
||||
private final Long updatedById;
|
||||
@SuppressWarnings("unused")
|
||||
private final ZonedDateTime updatedOn;
|
||||
@SuppressWarnings("unused")
|
||||
private final String createdBy;
|
||||
|
||||
private final List<EnumOptionData> reportRunFrequencies;
|
||||
|
||||
private final Long reportRunFrequency;
|
||||
|
||||
private final Long reportRunEvery;
|
||||
|
||||
private final ZonedDateTime lastRun;
|
||||
|
||||
public AdHocData(final Long id, final String name, final String query, final String tableName, final String tableFields,
|
||||
final boolean isActive, final ZonedDateTime createdOn, final Long createdById, final Long updatedById,
|
||||
final ZonedDateTime updatedOn, final String createdBy, final String email, final List<EnumOptionData> reportRunFrequencies,
|
||||
final Long reportRunFrequency, final Long reportRunEvery, final ZonedDateTime lastRun) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.query = query;
|
||||
this.tableName = tableName;
|
||||
this.tableFields = tableFields;
|
||||
this.isActive = isActive;
|
||||
this.createdOn = createdOn;
|
||||
this.createdById = createdById;
|
||||
this.updatedById = updatedById;
|
||||
this.updatedOn = updatedOn;
|
||||
this.createdBy = createdBy;
|
||||
this.email = email;
|
||||
this.reportRunFrequencies = reportRunFrequencies;
|
||||
this.reportRunFrequency = reportRunFrequency;
|
||||
this.reportRunEvery = reportRunEvery;
|
||||
this.lastRun = lastRun;
|
||||
}
|
||||
|
||||
public static AdHocData template() {
|
||||
List<EnumOptionData> reportRunFrequencies = Arrays.stream(ReportRunFrequency.values())
|
||||
.map(rrf -> new EnumOptionData(rrf.getValue(), rrf.getCode(), rrf.getCode())).collect(Collectors.toList());
|
||||
|
||||
AdHocData adHocData = new AdHocData(null, null, null, null, null, false, null, null, null, null, null, null, reportRunFrequencies,
|
||||
null, null, null);
|
||||
return adHocData;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getQuery() {
|
||||
return this.query;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
return this.tableName;
|
||||
}
|
||||
|
||||
public String getTableFields() {
|
||||
return this.tableFields;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return this.email;
|
||||
}
|
||||
|
||||
public boolean isActive() {
|
||||
return this.isActive;
|
||||
}
|
||||
|
||||
public ZonedDateTime getCreatedOn() {
|
||||
return this.createdOn;
|
||||
}
|
||||
|
||||
public Long getCreatedById() {
|
||||
return this.createdById;
|
||||
}
|
||||
|
||||
public Long getUpdatedById() {
|
||||
return this.updatedById;
|
||||
}
|
||||
|
||||
public ZonedDateTime getUpdatedOn() {
|
||||
return this.updatedOn;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return this.createdBy;
|
||||
}
|
||||
|
||||
public List<EnumOptionData> getReportRunFrequencies() {
|
||||
return this.reportRunFrequencies;
|
||||
}
|
||||
|
||||
public Long getReportRunFrequency() {
|
||||
return this.reportRunFrequency;
|
||||
}
|
||||
|
||||
public Long getReportRunEvery() {
|
||||
return this.reportRunEvery;
|
||||
}
|
||||
|
||||
public ZonedDateTime getLastRun() {
|
||||
return this.lastRun;
|
||||
return new AdHocData(null, null, null, null, null, null, false, null, null, null, null, null, reportRunFrequencies, null, null,
|
||||
null);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -100,8 +100,8 @@ public class AdHocReadPlatformServiceImpl implements AdHocReadPlatformService {
|
||||
final Long reportRunEvery = JdbcSupport.getLong(rs, "report_run_every");
|
||||
final ZonedDateTime lastRun = JdbcSupport.getDateTime(rs, "last_run");
|
||||
|
||||
return new AdHocData(id, name, query, tableName, tableFields, isActive, createdDate, createdById, updatedById, updatedOn,
|
||||
createdByUsername, email, AdHocData.template().getReportRunFrequencies(), reportRunFrequency, reportRunEvery, lastRun);
|
||||
return new AdHocData(id, name, query, tableName, tableFields, email, isActive, createdDate, createdById, updatedById, updatedOn,
|
||||
createdByUsername, AdHocData.template().getReportRunFrequencies(), reportRunFrequency, reportRunEvery, lastRun);
|
||||
}
|
||||
|
||||
public String schema() {
|
||||
|
||||
+6
-146
@@ -19,6 +19,9 @@
|
||||
package org.apache.fineract.batch.domain;
|
||||
|
||||
import java.util.Set;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Provides an object for separate HTTP requests in the Batch Request for Batch API. A requestId is also included as
|
||||
@@ -30,6 +33,9 @@ import java.util.Set;
|
||||
* @see org.apache.fineract.batch.api.BatchApiResource
|
||||
* @see Header
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class BatchRequest {
|
||||
|
||||
private Long requestId;
|
||||
@@ -38,150 +44,4 @@ public class BatchRequest {
|
||||
private Set<Header> headers;
|
||||
private Long reference;
|
||||
private String body;
|
||||
|
||||
/**
|
||||
* Constructs a 'BatchRequest' with requestId, relativeUrl, method, headers, reference and body of the incoming
|
||||
* request.
|
||||
*
|
||||
* @param requestId
|
||||
* of HTTP request.
|
||||
* @param relativeUrl
|
||||
* of HTTP request.
|
||||
* @param method
|
||||
* of HTTP request.
|
||||
* @param headers
|
||||
* of HTTP request.
|
||||
* @param reference
|
||||
* of HTTP request.
|
||||
* @param body
|
||||
* of HTTP request.
|
||||
*
|
||||
* @see Header
|
||||
*/
|
||||
public BatchRequest(Long requestId, String relativeUrl, String method, Set<Header> headers, Long reference, String body) {
|
||||
|
||||
this.requestId = requestId;
|
||||
this.relativeUrl = relativeUrl;
|
||||
this.method = method;
|
||||
this.headers = headers;
|
||||
this.reference = reference;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a default constructor of 'BatchRequest'
|
||||
*/
|
||||
public BatchRequest() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of 'requestId' of an object of this class.
|
||||
*
|
||||
* @return requestId of the HTTP request.
|
||||
*/
|
||||
public Long getRequestId() {
|
||||
return this.requestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'requestId' of an object of this class.
|
||||
*
|
||||
* @param requestId
|
||||
*/
|
||||
public void setRequestId(Long requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of 'relativeUrl' of an object of this class.
|
||||
*
|
||||
* @return relativeUrl of the HTTP request.
|
||||
*/
|
||||
public String getRelativeUrl() {
|
||||
return this.relativeUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'relativeUrl' of an object of this class.
|
||||
*
|
||||
* @param relativeUrl
|
||||
*/
|
||||
public void setRelativeUrl(String relativeUrl) {
|
||||
this.relativeUrl = relativeUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of 'method' of an object of this class.
|
||||
*
|
||||
* @return method of the HTTP request.
|
||||
*/
|
||||
public String getMethod() {
|
||||
return this.method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'method' of the object of this class.
|
||||
*
|
||||
* @param method
|
||||
*/
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the values of 'headers' of {@link Header} type of an object of this class.
|
||||
*
|
||||
* @return headers of the HTTP request.
|
||||
* @see Header
|
||||
*/
|
||||
public Set<Header> getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the values of 'headers' of {@link Header} type of an object of this class.
|
||||
*
|
||||
* @param headers
|
||||
* @see Header
|
||||
*/
|
||||
public void setHeaders(Set<Header> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of 'reference' of an object of this class
|
||||
*
|
||||
* @return reference of the HTTP request
|
||||
*/
|
||||
public Long getReference() {
|
||||
return this.reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'reference' of an object of this class.
|
||||
*
|
||||
* @param reference
|
||||
*/
|
||||
public void setReference(Long reference) {
|
||||
this.reference = reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value of 'body' of an object of this class.
|
||||
*
|
||||
* @return body of the HTTP request.
|
||||
*/
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'body' of an object of this class.
|
||||
*
|
||||
* @param body
|
||||
*/
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-98
@@ -19,6 +19,9 @@
|
||||
package org.apache.fineract.batch.domain;
|
||||
|
||||
import java.util.Set;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Provides an object for separate HTTP responses in the Batch Response for Batch API. It contains all the information
|
||||
@@ -31,108 +34,13 @@ import java.util.Set;
|
||||
* @see org.apache.fineract.batch.service.BatchApiService
|
||||
* @see Header
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class BatchResponse {
|
||||
|
||||
private Long requestId;
|
||||
private Integer statusCode;
|
||||
private Set<Header> headers;
|
||||
private String body;
|
||||
|
||||
/**
|
||||
* Constructs a 'BatchResponse' with requestId, statusCode, headers and body of the HTTP requests.
|
||||
*
|
||||
* @param requestId
|
||||
* @param statusCode
|
||||
* @param headers
|
||||
* @param body
|
||||
* @see Header
|
||||
*/
|
||||
public BatchResponse(Long requestId, Integer statusCode, Set<Header> headers, String body) {
|
||||
this.requestId = requestId;
|
||||
this.statusCode = statusCode;
|
||||
this.headers = headers;
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a default constructor of 'BatchResponse'
|
||||
*/
|
||||
public BatchResponse() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the 'requestId' of an object of this class.
|
||||
*
|
||||
* @return requestId of the HTTP request.
|
||||
*/
|
||||
public Long getRequestId() {
|
||||
return this.requestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'requestId' of an object of this class.
|
||||
*
|
||||
* @param requestId
|
||||
*/
|
||||
public void setRequestId(Long requestId) {
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the 'statusCode' of an object of this class.
|
||||
*
|
||||
* @return statusCode of the HTTP request.
|
||||
*/
|
||||
public Integer getStatusCode() {
|
||||
return this.statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'statusCode' of an object of this class.
|
||||
*
|
||||
* @param statusCode
|
||||
*/
|
||||
public void setStatusCode(Integer statusCode) {
|
||||
this.statusCode = statusCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the 'headers' of {@link Header} type of an object of this class.
|
||||
*
|
||||
* @return headers of the HTTP request.
|
||||
* @see Header
|
||||
*/
|
||||
public Set<Header> getHeaders() {
|
||||
return this.headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'headers' of {@link Header} type of an object of this class.
|
||||
*
|
||||
* @param headers
|
||||
* of {@link Header} Type
|
||||
* @see Header
|
||||
*/
|
||||
public void setHeaders(Set<Header> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the 'body' of an object of this class.
|
||||
*
|
||||
* @return body of the HTTP request.
|
||||
*/
|
||||
public String getBody() {
|
||||
return this.body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of 'body' of an object of this class.
|
||||
*
|
||||
* @param body
|
||||
*/
|
||||
public void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
*/
|
||||
package org.apache.fineract.batch.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Provides an object to handle HTTP headers as name and value pairs for Batch API. It is used in {@link BatchRequest}
|
||||
* and {@link BatchResponse} to store the information regarding the headers in incoming and outgoing JSON Strings.
|
||||
@@ -27,65 +31,11 @@ package org.apache.fineract.batch.domain;
|
||||
* @see BatchRequest
|
||||
* @see BatchResponse
|
||||
*/
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class Header {
|
||||
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* Constructs a 'Header' with the name and value of HTTP headers.
|
||||
*
|
||||
* @param name
|
||||
* of the HTTP header.
|
||||
* @param value
|
||||
* of the HTTP header.
|
||||
*/
|
||||
public Header(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a default constructor of 'Header'
|
||||
*/
|
||||
public Header() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the 'name' data field of the object of this class.
|
||||
*
|
||||
* @return name data field of this class
|
||||
*/
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets 'name' data field of this class.
|
||||
*
|
||||
* @param name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the 'value' data field of the object of this class.
|
||||
*
|
||||
* @return value data field of this class
|
||||
*/
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets 'value' data field of this class.
|
||||
*
|
||||
* @param value
|
||||
*/
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
config.stopBubbling = true
|
||||
|
||||
lombok.addLombokGeneratedAnnotation = true
|
||||
Reference in New Issue
Block a user