Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jleaf.erp.fin.bo.invoicearbackitem;
- import java.util.List;
- import javax.persistence.Query;
- import org.jleaf.core.AbstractBusinessFunction;
- import org.jleaf.core.BusinessFunction;
- import org.jleaf.core.Dto;
- import org.jleaf.core.GeneralConstants;
- import org.jleaf.core.annotation.Info;
- import org.jleaf.core.annotation.InfoIn;
- import org.jleaf.core.annotation.InfoOut;
- import org.jleaf.core.dao.QueryBuilder;
- import org.jleaf.erp.fin.bo.inquiryar.GetOustandingOrHistoryArForPartStation;
- import org.jleaf.erp.fin.dao.HandoverInvoiceArItemDao;
- import org.jleaf.erp.fin.dao.InvoiceArBalanceDao;
- import org.jleaf.erp.fin.entity.InvoiceArBalance;
- import org.jleaf.erp.fin.dao.HandoverInvoiceArItemDao;
- import org.jleaf.erp.fin.entity.HandoverInvoiceArItem;
- import org.jleaf.util.DtoUtil;
- import org.jleaf.util.ValidationUtil;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- @Service
- @InfoIn(value = {
- @Info(name = "handoverInvoiceArId", description = "Handover Invoice Ar Id", type = Long.class)
- })
- @InfoOut(value = {
- @Info(name = "handoverInvoiceARItemList", description = "Handover Invoice Ar list (id, handoverInvoiceArId, tenantId, refId, refDocTypeId, refDocType, refDocNo, refDocDate, partnerId, partnerCode, partnerName, dueDate, currCode, invoiceAmount, outstandingAmount, handoverStatus, remark, createUserId, createDateTime, updateUserId, updateDateTime, version)", type = List.class)
- })
- public class GetHandoverInvoiceArBackItemListByHandoverInvoiceArId extends AbstractBusinessFunction implements BusinessFunction {
- private static final Logger log = LoggerFactory.getLogger(GetHandoverInvoiceArBackItemListByHandoverInvoiceArId.class);
- @Autowired
- private HandoverInvoiceArItemDao handoverInvoiceArItemDao;
- @Override
- public String getDescription() {
- return "Get Handover Invoice Ar Back Item List By Handover Invoice Ar Id";
- }
- @SuppressWarnings("unchecked")
- @Override
- public Dto execute(Dto inputDto) throws Exception {
- ValidationUtil.valNumeric(inputDto, "handoverInvoiceArId");
- Long handoverInvoiceArId = inputDto.getLong("handoverInvoiceArId");
- QueryBuilder queryBuilder = new QueryBuilder(); //SELECT nya sesuaikan dengan list output nya
- queryBuilder.add(" SELECT A.handover_invoice_ar_item_id, A.handover_invoice_ar_id, A.tenant_id, ")
- .add(" A.ref_id, A.ref_doc_type_id, f_get_doc_desc(ref_doc_type_id) AS ref_doc_type, A.ref_doc_no, A.ref_doc_date, ")
- .add(" A.partner_id, f_get_partner_code(partner_id) AS partner_code, f_get_partner_name(partner_id) AS partner_name, ")
- .add(" A.due_date, A.curr_code, A.invoice_amount, A.outstanding_amount, A.handover_status, A.remark, ")
- .add(" A.create_user_id, A.create_datetime, A.update_user_id, A.update_datetime, A.version ")
- .add(" FROM ")
- .add(HandoverInvoiceArItem.TABLE_NAME)
- .add(" A ")
- .add(" WHERE handoverInvoiceArId = :handoverInvoiceArId ");
- Query query = handoverInvoiceArItemDao.createNativeQuery(queryBuilder.toString());
- query.setParameter("handoverInvoiceArId", handoverInvoiceArId);
- List<Object[]> handoverInvoiceARItemList = query.getResultList();
- return new Dto().put("invoiceList", DtoUtil.createDtoListFromArray(handoverInvoiceARItemList, "id", "handoverInvoiceArId", "tenantId", "refId", "refDocTypeId", "refDocType", "refDocNo", "refDocDate", "partnerId", "partnerCode", "partnerName", "dueDate", "currCode", "invoiceAmount", "outstandingAmount", "handoverStatus", "remark", "createUserId", "createDateTime", "updateUserId", "updateDateTime", "version"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement