Advertisement
Guest User

BF GetHandoverInvoiceArBackItemListByHandoverInvoiceArId

a guest
Jan 22nd, 2020
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.66 KB | None | 0 0
  1. package org.jleaf.erp.fin.bo.invoicearbackitem;
  2.  
  3.  
  4. import java.util.List;
  5.  
  6. import javax.persistence.Query;
  7.  
  8. import org.jleaf.core.AbstractBusinessFunction;
  9. import org.jleaf.core.BusinessFunction;
  10. import org.jleaf.core.Dto;
  11. import org.jleaf.core.GeneralConstants;
  12. import org.jleaf.core.annotation.Info;
  13. import org.jleaf.core.annotation.InfoIn;
  14. import org.jleaf.core.annotation.InfoOut;
  15. import org.jleaf.core.dao.QueryBuilder;
  16. import org.jleaf.erp.fin.bo.inquiryar.GetOustandingOrHistoryArForPartStation;
  17. import org.jleaf.erp.fin.dao.HandoverInvoiceArItemDao;
  18. import org.jleaf.erp.fin.dao.InvoiceArBalanceDao;
  19. import org.jleaf.erp.fin.entity.InvoiceArBalance;
  20. import org.jleaf.erp.fin.dao.HandoverInvoiceArItemDao;
  21. import org.jleaf.erp.fin.entity.HandoverInvoiceArItem;
  22. import org.jleaf.util.DtoUtil;
  23. import org.jleaf.util.ValidationUtil;
  24. import org.slf4j.Logger;
  25. import org.slf4j.LoggerFactory;
  26. import org.springframework.beans.factory.annotation.Autowired;
  27. import org.springframework.stereotype.Service;
  28.  
  29. @Service
  30. @InfoIn(value = {
  31. @Info(name = "handoverInvoiceArId", description = "Handover Invoice Ar Id", type = Long.class)
  32. })
  33. @InfoOut(value = {
  34. @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)
  35. })
  36.  
  37. public class GetHandoverInvoiceArBackItemListByHandoverInvoiceArId extends AbstractBusinessFunction implements BusinessFunction {
  38.  
  39. private static final Logger log = LoggerFactory.getLogger(GetHandoverInvoiceArBackItemListByHandoverInvoiceArId.class);
  40.  
  41. @Autowired
  42. private HandoverInvoiceArItemDao handoverInvoiceArItemDao;
  43.  
  44. @Override
  45. public String getDescription() {
  46. return "Get Handover Invoice Ar Back Item List By Handover Invoice Ar Id";
  47. }
  48.  
  49. @SuppressWarnings("unchecked")
  50. @Override
  51. public Dto execute(Dto inputDto) throws Exception {
  52.  
  53. ValidationUtil.valNumeric(inputDto, "handoverInvoiceArId");
  54.  
  55. Long handoverInvoiceArId = inputDto.getLong("handoverInvoiceArId");
  56.  
  57. QueryBuilder queryBuilder = new QueryBuilder(); //SELECT nya sesuaikan dengan list output nya
  58. queryBuilder.add(" SELECT A.handover_invoice_ar_item_id, A.handover_invoice_ar_id, A.tenant_id, ")
  59. .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, ")
  60. .add(" A.partner_id, f_get_partner_code(partner_id) AS partner_code, f_get_partner_name(partner_id) AS partner_name, ")
  61. .add(" A.due_date, A.curr_code, A.invoice_amount, A.outstanding_amount, A.handover_status, A.remark, ")
  62. .add(" A.create_user_id, A.create_datetime, A.update_user_id, A.update_datetime, A.version ")
  63. .add(" FROM ")
  64. .add(HandoverInvoiceArItem.TABLE_NAME)
  65. .add(" A ")
  66. .add(" WHERE handoverInvoiceArId = :handoverInvoiceArId ");
  67.  
  68. Query query = handoverInvoiceArItemDao.createNativeQuery(queryBuilder.toString());
  69.  
  70. query.setParameter("handoverInvoiceArId", handoverInvoiceArId);
  71.  
  72. List<Object[]> handoverInvoiceARItemList = query.getResultList();
  73.  
  74. 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"));
  75. }
  76.  
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement