Advertisement
Evra70

Untitled

Apr 29th, 2020
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.08 KB | None | 0 0
  1. package org.jleaf.erp.sls.bo.salesman;
  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.bo.partner.FindPartnerByIndex;
  18. import org.jleaf.erp.master.dao.PartnerDao;
  19. import org.jleaf.erp.master.entity.Partner;
  20. import org.jleaf.erp.master.entity.PartnerAddress;
  21. import org.jleaf.erp.master.entity.PartnerCp;
  22. import org.jleaf.erp.master.entity.PartnerType;
  23. import org.jleaf.erp.sls.SalesConstants;
  24. import org.jleaf.erp.sls.dao.SalesmanVisitPlanDao;
  25. import org.jleaf.erp.sls.entity.Order;
  26. import org.jleaf.erp.sls.entity.PolicyCustomerGroupBrand;
  27. import org.jleaf.erp.sls.entity.SalesmanDate;
  28. import org.jleaf.erp.sls.entity.SalesmanVisitPlan;
  29. import org.jleaf.erp.sls.entity.UserPartner;
  30. import org.jleaf.util.DtoUtil;
  31. import org.jleaf.util.ValidationUtil;
  32. import org.slf4j.Logger;
  33. import org.slf4j.LoggerFactory;
  34. import org.springframework.beans.factory.annotation.Autowired;
  35. import org.springframework.stereotype.Service;
  36.  
  37. /**
  38.  *
  39.  * @author Ephraim Jehudah, April 09, 2020
  40.  *
  41.  **/
  42.  
  43. //@formatter:off
  44. @Service
  45. @InfoIn(value = {
  46.     @Info(name = "userLoginId", description = "user Login Id", type = Long.class),
  47.     @Info(name = "tenantLoginId", description = "tenant Login Id", type = Long.class),
  48.     @Info(name = "roleLoginId", description = "roleLoginId", type = Long.class),
  49.     @Info(name = "datetime", description = "datetime", type = String.class),
  50.     @Info(name = "apiKey", description = "apiKey", type = String.class),
  51.     @Info(name = "salesmanId", description = "salesman Id", type = Long.class),
  52.     @Info(name = "date", description = "date", type = String.class),
  53. })
  54. @InfoOut(value = {
  55.     @Info(name = "salesmanVisitSummary", description = "salesmanVisitSummary {targetCall, realCall, callLeft, daysLeft, turnoverRealization}", type = Object.class)
  56. })
  57. //@formatter:on
  58. public class GetTodaySalesmanVisitSummaryBySalesmanId extends AbstractBusinessFunction implements BusinessFunction {
  59.     private static final Logger log = LoggerFactory.getLogger(GetTodaySalesmanVisitSummaryBySalesmanId.class);
  60.    
  61.     @Autowired
  62.     PartnerDao partnerDao;
  63.    
  64.     @Autowired
  65.     SalesmanVisitPlanDao salesmanVisitPlanDao;
  66.  
  67.     @Override
  68.     public String getDescription() {
  69.         return "Find Salesman Visit Summary";
  70.     }
  71.  
  72.     @SuppressWarnings("unchecked")
  73.     @Override
  74.     public Dto execute(Dto inputDto) throws Exception {
  75.         log.info("Input YANG MASUK BF {} -. {} ", inputDto);
  76.  
  77.         ValidationUtil.valDtoContainsKey(inputDto, "userLoginId");
  78.         ValidationUtil.valDtoContainsKey(inputDto, "tenantLoginId");
  79.         ValidationUtil.valDtoContainsKey(inputDto, "roleLoginId");
  80.         ValidationUtil.valDtoContainsKey(inputDto, "datetime");
  81.         ValidationUtil.valDtoContainsKey(inputDto, "salesmanId");
  82.         ValidationUtil.valDtoContainsKey(inputDto, "date");
  83.  
  84.         Long userLoginId = inputDto.getLong("userLoginId");
  85.         Long tenantLoginId = inputDto.getLong("tenantLoginId");
  86.         Long roleLoginId = inputDto.getLong("roleLoginId");
  87.         String datetime = inputDto.getString("datetime");
  88.         String date = inputDto.getString("date").substring(0,8);
  89.         String yearMonthDate = date.substring(0,6);
  90.         String yearMonthDateLike = date.substring(0,6).concat("%");
  91.         Long salesmanId = inputDto.getLong("salesmanId");
  92.         Long salesmanPartnerId = -99L;
  93.        
  94.        
  95.         Dto outputDto = new Dto();
  96.         List<Object[]> result = null;
  97.         Dto outputSummary = new Dto();
  98.  
  99.        
  100.         //all result
  101.         outputDto.put("salesmanVisitSummary", outputSummary);
  102.         log.debug("Output BF {} -. {} ", this.getClass(), outputDto);
  103.  
  104.         return outputDto;
  105.     }
  106.  
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement