current account save api update

This commit is contained in:
Nitesh Yadav
2026-04-29 18:07:37 +05:30
parent a7965f8792
commit 15fa25f463
12 changed files with 12312 additions and 180 deletions
@@ -0,0 +1,29 @@
/**
* 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.
*/
package org.apache.fineract.portfolio.currentaccount.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
public class CurrentAccountNotFoundException extends AbstractPlatformResourceNotFoundException {
public CurrentAccountNotFoundException(Long id) {
super("error.msg.current.account.id.invalid",
"Current account with identifier " + id + " does not exist", id);
}
}
@@ -27,7 +27,7 @@ import org.springframework.stereotype.Component;
/**
* Generates CBS account numbers for current accounts.
* Format: 00 + GL_CODE(6 digits) + OFFICE_ID(2 digits) + ACCOUNT_ID(5 digits) = 15 digits
* GL code is fetched from m_current_product.gl_account_id → m_acc_gl_account.gl_code
* GL code is fetched from m_current_product.gl_account_id → acc_gl_account.gl_code
*/
@Component
@RequiredArgsConstructor
@@ -43,7 +43,7 @@ public class CurrentAccountNumberGenerator {
// Fetch gl_code directly from current product → gl account
String glCode = jdbcTemplate.query(
"SELECT ga.gl_code FROM m_current_product cp "
+ "JOIN m_acc_gl_account ga ON ga.id = cp.gl_account_id "
+ "JOIN acc_gl_account ga ON ga.id = cp.gl_account_id "
+ "WHERE cp.id = ?",
rs -> rs.next() ? rs.getString("gl_code") : null,
productId);
@@ -69,7 +69,7 @@ public class CurrentAccountNumberGenerator {
public String preview(Long productId, Long officeId) {
String glCode = jdbcTemplate.query(
"SELECT ga.gl_code FROM m_current_product cp "
+ "JOIN m_acc_gl_account ga ON ga.id = cp.gl_account_id "
+ "JOIN acc_gl_account ga ON ga.id = cp.gl_account_id "
+ "WHERE cp.id = ?",
rs -> rs.next() ? rs.getString("gl_code") : null,
productId);
@@ -0,0 +1,29 @@
/**
* 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.
*/
package org.apache.fineract.portfolio.currentaccount.service;
import java.util.List;
import java.util.Map;
public interface CurrentAccountReadPlatformService {
Map<String, Object> retrieveOne(Long accountId);
List<Map<String, Object>> retrieveAll();
}