Skip to content

Commit

Permalink
Implement transaction-account-report-item
Browse files Browse the repository at this point in the history
  • Loading branch information
ghacupha committed Nov 15, 2024
1 parent 0bed87a commit 7d61238
Show file tree
Hide file tree
Showing 25 changed files with 2,190 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .jhipster/TransactionAccountReportItem.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"fields": [
{
"fieldName": "accountName",
"fieldType": "String"
},
{
"fieldName": "accountNumber",
"fieldType": "String"
},
{
"fieldName": "accountBalance",
"fieldType": "BigDecimal"
}
],
"relationships": [],
"service": "serviceImpl",
"dto": "mapstruct",
"jpaMetamodelFiltering": true,
"readOnly": true,
"pagination": "pagination",
"name": "TransactionAccountReportItem",
"changelogDate": "20241115120936",
"incrementalChangelog": false
}
5 changes: 3 additions & 2 deletions .yo-rc.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,16 @@
"TACompilationRequest",
"RouInitialDirectCost",
"TransactionAccountLedger",
"ReportingEntity"
"ReportingEntity",
"TransactionAccountReportItem"
],
"entitySuffix": "",
"incrementalChangelog": false,
"jhiPrefix": "jhi",
"jhipsterVersion": "7.3.1",
"jwtSecretKey": "ZWMyYzI1MmU3Mzg1ZTU4ZjFmOTIzYjEzOWZkZWU1MWZhNGY4ZTA3ZTEwYmYxMzczOGE3NDZiZjNkMDE3NjNiYTBmMTE0ODBiYTcyZDI0ZTcyNmU5OTA2NGY4NDUwZGEyMWQwYThmMTgxNWJiMjQ2OGQ0NmIxMTQwNTE0MGFkNzA=",
"languages": ["en", "fr", "it", "de"],
"lastLiquibaseTimestamp": 1731666872000,
"lastLiquibaseTimestamp": 1731672576000,
"messageBroker": "kafka",
"nativeLanguage": "en",
"otherModules": [],
Expand Down
136 changes: 136 additions & 0 deletions src/main/java/io/github/erp/domain/TransactionAccountReportItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
package io.github.erp.domain;

/*-
* Erp System - Mark X No 10 (Jehoiada Series) Server ver 1.8.2
* Copyright © 2021 - 2024 Edwin Njeru and the ERP System Contributors ([email protected])
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.*;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
* A TransactionAccountReportItem.
*/
@Entity
@Table(name = "transaction_account_report_item")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@org.springframework.data.elasticsearch.annotations.Document(indexName = "transactionaccountreportitem")
public class TransactionAccountReportItem implements Serializable {

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
@Column(name = "id")
private Long id;

@Column(name = "account_name")
private String accountName;

@Column(name = "account_number")
private String accountNumber;

@Column(name = "account_balance", precision = 21, scale = 2)
private BigDecimal accountBalance;

// jhipster-needle-entity-add-field - JHipster will add fields here

public Long getId() {
return this.id;
}

public TransactionAccountReportItem id(Long id) {
this.setId(id);
return this;
}

public void setId(Long id) {
this.id = id;
}

public String getAccountName() {
return this.accountName;
}

public TransactionAccountReportItem accountName(String accountName) {
this.setAccountName(accountName);
return this;
}

public void setAccountName(String accountName) {
this.accountName = accountName;
}

public String getAccountNumber() {
return this.accountNumber;
}

public TransactionAccountReportItem accountNumber(String accountNumber) {
this.setAccountNumber(accountNumber);
return this;
}

public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}

public BigDecimal getAccountBalance() {
return this.accountBalance;
}

public TransactionAccountReportItem accountBalance(BigDecimal accountBalance) {
this.setAccountBalance(accountBalance);
return this;
}

public void setAccountBalance(BigDecimal accountBalance) {
this.accountBalance = accountBalance;
}

// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof TransactionAccountReportItem)) {
return false;
}
return id != null && id.equals(((TransactionAccountReportItem) o).id);
}

@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}

// prettier-ignore
@Override
public String toString() {
return "TransactionAccountReportItem{" +
"id=" + getId() +
", accountName='" + getAccountName() + "'" +
", accountNumber='" + getAccountNumber() + "'" +
", accountBalance=" + getAccountBalance() +
"}";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package io.github.erp.erp.resources.ledgers;

/*-
* Erp System - Mark X No 10 (Jehoiada Series) Server ver 1.8.2
* Copyright © 2021 - 2024 Edwin Njeru and the ERP System Contributors ([email protected])
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

import io.github.erp.internal.repository.InternalTransactionAccountReportItemRepository;
import io.github.erp.internal.service.ledgers.InternalTransactionAccountReportItemService;
import io.github.erp.repository.TransactionAccountReportItemRepository;
import io.github.erp.service.TransactionAccountReportItemQueryService;
import io.github.erp.service.TransactionAccountReportItemService;
import io.github.erp.service.criteria.TransactionAccountReportItemCriteria;
import io.github.erp.service.dto.TransactionAccountReportItemDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import tech.jhipster.web.util.PaginationUtil;
import tech.jhipster.web.util.ResponseUtil;

import java.time.LocalDate;
import java.util.List;
import java.util.Optional;

/**
* REST controller for managing {@link io.github.erp.domain.TransactionAccountReportItem}.
*/
@RestController
@RequestMapping("/api/accounts")
public class TransactionAccountReportItemResourceProd {

private final Logger log = LoggerFactory.getLogger(TransactionAccountReportItemResourceProd.class);

private final InternalTransactionAccountReportItemService transactionAccountReportItemService;

private final InternalTransactionAccountReportItemRepository transactionAccountReportItemRepository;

private final TransactionAccountReportItemQueryService transactionAccountReportItemQueryService;

public TransactionAccountReportItemResourceProd(
InternalTransactionAccountReportItemService transactionAccountReportItemService,
InternalTransactionAccountReportItemRepository transactionAccountReportItemRepository,
TransactionAccountReportItemQueryService transactionAccountReportItemQueryService
) {
this.transactionAccountReportItemService = transactionAccountReportItemService;
this.transactionAccountReportItemRepository = transactionAccountReportItemRepository;
this.transactionAccountReportItemQueryService = transactionAccountReportItemQueryService;
}

/**
* {@code GET /transaction-account-report-items} : get all the transactionAccountReportItems.
*
* @param pageable the pagination information.
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the list of transactionAccountReportItems in body.
*/
@GetMapping("/transaction-account-report-items")
public ResponseEntity<List<TransactionAccountReportItemDTO>> getAllTransactionAccountReportItems(
TransactionAccountReportItemCriteria criteria,
Pageable pageable
) {
log.debug("REST request to get TransactionAccountReportItems by criteria: {}", criteria);
Page<TransactionAccountReportItemDTO> page = transactionAccountReportItemService.findAll(LocalDate.of(2024,7,31), pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}

/**
* {@code GET /transaction-account-report-items/count} : count all the transactionAccountReportItems.
*
* @param criteria the criteria which the requested entities should match.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and the count in body.
*/
@GetMapping("/transaction-account-report-items/count")
public ResponseEntity<Long> countTransactionAccountReportItems(TransactionAccountReportItemCriteria criteria) {
log.debug("REST request to count TransactionAccountReportItems by criteria: {}", criteria);
return ResponseEntity.ok().body(transactionAccountReportItemQueryService.countByCriteria(criteria));
}

/**
* {@code GET /transaction-account-report-items/:id} : get the "id" transactionAccountReportItem.
*
* @param id the id of the transactionAccountReportItemDTO to retrieve.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body the transactionAccountReportItemDTO, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/transaction-account-report-items/{id}")
public ResponseEntity<TransactionAccountReportItemDTO> getTransactionAccountReportItem(@PathVariable Long id) {
log.debug("REST request to get TransactionAccountReportItem : {}", id);
Optional<TransactionAccountReportItemDTO> transactionAccountReportItemDTO = transactionAccountReportItemService.findOne(id);
return ResponseUtil.wrapOrNotFound(transactionAccountReportItemDTO);
}

/**
* {@code SEARCH /_search/transaction-account-report-items?query=:query} : search for the transactionAccountReportItem corresponding
* to the query.
*
* @param query the query of the transactionAccountReportItem search.
* @param pageable the pagination information.
* @return the result of the search.
*/
@GetMapping("/_search/transaction-account-report-items")
public ResponseEntity<List<TransactionAccountReportItemDTO>> searchTransactionAccountReportItems(
@RequestParam String query,
Pageable pageable
) {
log.debug("REST request to search for a page of TransactionAccountReportItems for query {}", query);
Page<TransactionAccountReportItemDTO> page = transactionAccountReportItemService.search(query, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return ResponseEntity.ok().headers(headers).body(page.getContent());
}
}
Loading

0 comments on commit 7d61238

Please sign in to comment.