Evra70

Untitled

Apr 29th, 2020
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.37 KB | None | 0 0
  1. package org.jleaf.erp.sls.bo.customer;
  2.  
  3. import java.util.List;
  4.  
  5. import javax.persistence.Query;
  6.  
  7. import org.jleaf.common.entity.User;
  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.CriteriaHelper;
  16. import org.jleaf.core.dao.QueryBuilder;
  17. import org.jleaf.erp.master.dao.PartnerDao;
  18. import org.jleaf.erp.master.entity.Partner;
  19. import org.jleaf.erp.master.entity.PartnerAddress;
  20. import org.jleaf.erp.master.entity.PartnerCp;
  21. import org.jleaf.erp.master.entity.PartnerType;
  22. import org.jleaf.erp.sls.SalesConstants;
  23. import org.jleaf.erp.sls.entity.PolicyCustomerGroupBrand;
  24. import org.jleaf.erp.sls.entity.UserPartner;
  25. import org.jleaf.util.DtoUtil;
  26. import org.jleaf.util.ValidationUtil;
  27. import org.slf4j.Logger;
  28. import org.slf4j.LoggerFactory;
  29. import org.springframework.beans.factory.annotation.Autowired;
  30. import org.springframework.stereotype.Service;
  31.  
  32. /**
  33.  *
  34.  * @author Ephraim Jehudah, April 09, 2020
  35.  *
  36.  **/
  37.  
  38. //@formatter:off
  39. @Service
  40. @InfoIn(value = {
  41.     @Info(name = "userLoginId", description = "user Login Id", type = Long.class),
  42.     @Info(name = "tenantLoginId", description = "tenant Login Id", type = Long.class),
  43.     @Info(name = "roleLoginId", description = "roleLoginId", type = Long.class),
  44.     @Info(name = "datetime", description = "datetime", type = String.class),
  45.     @Info(name = "customerId", description = "customer Id", type = Long.class),
  46.     @Info(name = "statusPiutang", description = "status Piutang", type = String.class),
  47.     @Info(name = "apiKey", description = "apiKey", type = String.class),
  48. })
  49. @InfoOut(value = {
  50.     @Info(name = "saldoPiutangList", description = "saldoPiutangList (invoiceDocNo,invoiceDocDate, invoiceDueDate, sisaPiutang, statusPiutang)", type = List.class)
  51. })
  52. //@formatter:on
  53. public class GetSaldoPiutangListByCustomer extends AbstractBusinessFunction implements BusinessFunction {
  54.     private static final Logger log = LoggerFactory.getLogger(GetSaldoPiutangListByCustomer.class);
  55.    
  56.     @Autowired
  57.     PartnerDao partnerDao;
  58.  
  59.     @Override
  60.     public String getDescription() {
  61.         return "GetSaldoPiutangListByCustomer";
  62.     }
  63.  
  64.     @SuppressWarnings("unchecked")
  65.     @Override
  66.     public Dto execute(Dto inputDto) throws Exception {
  67.         log.info("Input BF {} -. {} ", inputDto);
  68.  
  69.         ValidationUtil.valDtoContainsKey(inputDto, "userLoginId");
  70.         ValidationUtil.valDtoContainsKey(inputDto, "tenantLoginId");
  71.         ValidationUtil.valDtoContainsKey(inputDto, "roleLoginId");
  72.         ValidationUtil.valDtoContainsKey(inputDto, "datetime");
  73.  
  74.         Long customerId = inputDto.getLong("customerId");
  75.         String statusPiutang = inputDto.getString("statusPiutang");
  76.            
  77.         Dto outputDto = null;
  78.         List<Object[]> result = null;
  79.  
  80.  
  81.         // jumlah key pada list harus sama dengan jumlah kolom yang diselect
  82.         outputDto = new Dto();
  83.         outputDto.putList("saldoPiutangList", DtoUtil.createDtoListFromArray(result,
  84.         "invoiceDocNo","invoiceDocDate", "invoiceDueDate", "sisaPiutang", "statusPiutang"));
  85.  
  86.         log.debug("Output BF {} -. {} ", this.getClass(), outputDto);
  87.  
  88.         return outputDto;
  89.     }
  90.  
  91. }
Advertisement
Add Comment
Please, Sign In to add comment