Advertisement
Evra70

Untitled

Apr 29th, 2020
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.78 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.dao.OrderDao;
  24. import org.jleaf.erp.sls.entity.PolicyCustomerGroupBrand;
  25. import org.jleaf.erp.sls.entity.UserPartner;
  26. import org.jleaf.util.DtoUtil;
  27. import org.jleaf.util.ValidationUtil;
  28. import org.slf4j.Logger;
  29. import org.slf4j.LoggerFactory;
  30. import org.springframework.beans.factory.annotation.Autowired;
  31. import org.springframework.stereotype.Service;
  32.  
  33. /**
  34.  *
  35.  * @author Ephraim Jehudah, April 09, 2020
  36.  *
  37.  **/
  38.  
  39. //@formatter:off
  40. @Service
  41. @InfoIn(value = {
  42.     @Info(name = "apiKey", description = "api Key", type = String.class),
  43.     @Info(name = "salesmanId", description = "salesmanId", type = Long.class),
  44.     @Info(name = "datetime", description = "datetime", type = String.class),
  45.     @Info(name = "userLoginId", description = "user Login Id", type = Long.class),
  46.     @Info(name = "tenantLoginId", description = "tenant Login Id", type = Long.class),
  47.     @Info(name = "roleLoginId", description = "roleLoginId", type = Long.class),
  48. })
  49. @InfoOut(value = {
  50.     @Info(name = "customerWithSaldoPiutangList", description = "customerWithSaldoPiutangList (customerId, customerName, totalSaldoPiutang, totalSaldoPiutangDueDate, totalSaldoPiutangNotDueDate)", type = List.class)
  51. })
  52. //@formatter:on
  53. public class GetCustomerListWithSaldoPiutangBySalesmanId extends AbstractBusinessFunction implements BusinessFunction {
  54.     private static final Logger log = LoggerFactory.getLogger(GetCustomerListWithSaldoPiutangBySalesmanId.class);
  55.    
  56.     @Autowired
  57.     OrderDao orderDao;
  58.  
  59.     @Override
  60.     public String getDescription() {
  61.         return "Get Customer List With Saldo Piutang By Salesman";
  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, "apiKey");
  70.         ValidationUtil.valDtoContainsKey(inputDto, "salesmanId");
  71.         ValidationUtil.valDtoContainsKey(inputDto, "datetime");
  72.         ValidationUtil.valDtoContainsKey(inputDto, "userLoginId");
  73.         ValidationUtil.valDtoContainsKey(inputDto, "tenantLoginId");
  74.         ValidationUtil.valDtoContainsKey(inputDto, "roleLoginId");
  75.  
  76.         Long salesmanId = inputDto.getLong("salesmanId");
  77.         Long userLoginId = inputDto.getLong("userLoginId");
  78.         Long tenantLoginId = inputDto.getLong("tenantLoginId");
  79.         Long roleLoginId = inputDto.getLong("roleLoginId");
  80.         String datetime = inputDto.getString("datetime");
  81.            
  82.         Dto outputDto = new Dto();
  83.         List<Object[]> result = null;
  84.  
  85.        
  86.         // jumlah key pada list harus sama dengan jumlah kolom yang diselect
  87.         outputDto = new Dto();
  88. //        outputDto.putList("customerWithSaldoPiutangList",DtoUtil.createDtoListFromArray(result, "customerId", "customerName",
  89. //                "totalSaldoPiutang", "totalSaldoPiutangDueDate", "totalSaldoPiutangNotDueDate"));
  90.  
  91.         log.debug("Output BF {} -. {} ", this.getClass(), outputDto);
  92.  
  93.         return outputDto;
  94.     }
  95.  
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement