Commit c126891b authored by Tu Bach's avatar Tu Bach

tubn campaign execute get customer

parent 433be62c
...@@ -7,8 +7,8 @@ import org.springframework.stereotype.Repository; ...@@ -7,8 +7,8 @@ import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@Repository @Repository
@Transactional(DataSourceQualify.ACD_FULL)
public interface AgentsRepository extends JpaRepository<Agents, String> { public interface AgentsRepository extends JpaRepository<Agents, String> {
@Transactional(DataSourceQualify.ACD_FULL)
Agents findByAgentId(String agentId); Agents findByAgentId(String agentId);
} }
...@@ -21,8 +21,6 @@ public interface ApParamRepository extends JpaRepository<ApParam, Long>, ApParam ...@@ -21,8 +21,6 @@ public interface ApParamRepository extends JpaRepository<ApParam, Long>, ApParam
@Query(value = "SELECT p FROM ApParam p WHERE status = 1 AND parType LIKE concat('%', :parType, '%') ") @Query(value = "SELECT p FROM ApParam p WHERE status = 1 AND parType LIKE concat('%', :parType, '%') ")
List<ApParam> findParamByParType(@Param("parType") String parType); List<ApParam> findParamByParType(@Param("parType") String parType);
@Query(value = "select a from ApParam a WHERE status = 1 AND parType = 'CAMPAIGN_TYPE'") @Query(value = "FROM ApParam WHERE status = 1 AND parType = :parType")
List<ApParam> findAllParam(); List<ApParam> findAllParam(@Param("parType") String parType);
} }
package com.viettel.campaign.repository.ccms_full; package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.CampaignCustomer; import com.viettel.campaign.model.ccms_full.CampaignCustomer;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Transactional(DataSourceQualify.CCMS_FULL)
public interface CampaignCustomerRepository extends JpaRepository<CampaignCustomer, Long> { public interface CampaignCustomerRepository extends JpaRepository<CampaignCustomer, Long> {
@Query(value = "SELECT COUNT(*) " + @Query(value = "SELECT COUNT(*) " +
"FROM CAMPAIGN_CUSTOMER CC JOIN CAMPAIGN_COMPLETE_CODE CCC ON CC.CAMPAIGN_ID = CCC.CAMPAIGN_ID " + "FROM CAMPAIGN_CUSTOMER CC JOIN CAMPAIGN_COMPLETE_CODE CCC ON CC.CAMPAIGN_ID = CCC.CAMPAIGN_ID " +
"WHERE CC.STATUS = 3 AND CC.CAMPAIGN_ID = :campaignId AND CC.CUSTOMER_ID = :customerId AND CCC.IS_RECALL = 1 AND CCC.STATUS = 1 ", "WHERE CC.STATUS = 3 AND CC.CAMPAIGN_ID = :campaignId AND CC.CUSTOMER_ID = :customerId AND CCC.IS_RECALL = 1 AND CCC.STATUS = 1 ",
nativeQuery = true) nativeQuery = true)
Long getCustomerRecall(@Param("campaignId") Long campaignId, @Param("customerId") Long customerId); Long getCustomerRecall(@Param("campaignId") Long campaignId, @Param("customerId") Long customerId);
@Query(value = "SELECT cc.customer_id \n" +
"FROM campaign_customer cc LEFT JOIN receive_cust_log cl ON cc.customer_id = cl.customer_id\n" +
"WHERE cc.campaign_id = :campaignId \n" +
" AND cc.agent_id = :agentId \n" +
" AND cc.in_campaign_status = 1 \n" +
" AND cl.customer_id IS NULL \n" +
" AND EXISTS(SELECT 1 \n" +
" FROM campaign_complete_code ccc \n" +
" WHERE cc.status = ccc.complete_value \n" +
" AND ccc.status = 1 \n" +
" AND ccc.is_recall = 1 \n" +
" AND ccc.complete_type = 2 \n" +
" AND ccc.company_site_id = :companySiteId) \n" +
" AND cc.recall_time <= SYSDATE\n" +
" AND cc.recall_time + interval :apParam MINUTE >= SYSDATE", nativeQuery = true)
List<CampaignCustomer> getCustomerRecallDate(@Param("campaignId") Long campaignId, @Param("agentId") Long agentId, @Param("companySiteId") Long companySiteId, @Param("apParam") String apParam);
} }
...@@ -16,7 +16,7 @@ public interface ApParamService { ...@@ -16,7 +16,7 @@ public interface ApParamService {
ResultDTO findParamByParType(String parType); ResultDTO findParamByParType(String parType);
List<ApParam>findAllParam(); List<ApParam>findAllParam(String parType);
} }
...@@ -90,7 +90,7 @@ public class ApParamServiceImpl implements ApParamService { ...@@ -90,7 +90,7 @@ public class ApParamServiceImpl implements ApParamService {
return resultDTO; return resultDTO;
} }
public List<ApParam> findAllParam() { public List<ApParam> findAllParam(String parType) {
return apParamRepository.findAllParam(); return apParamRepository.findAllParam(parType);
} }
} }
...@@ -2,6 +2,7 @@ package com.viettel.campaign.service.impl; ...@@ -2,6 +2,7 @@ package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify; import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.acd_full.Agents; import com.viettel.campaign.model.acd_full.Agents;
import com.viettel.campaign.model.ccms_full.CampaignCustomer;
import com.viettel.campaign.model.ccms_full.TimeRangeDialMode; import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode; import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
import com.viettel.campaign.repository.acd_full.AgentsRepository; import com.viettel.campaign.repository.acd_full.AgentsRepository;
...@@ -38,6 +39,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -38,6 +39,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Autowired @Autowired
CampaignExecuteRepository campaignExecuteRepository; CampaignExecuteRepository campaignExecuteRepository;
@Autowired
CampaignCustomerRepository campaignCustomerRepository;
@Autowired @Autowired
AgentsRepository agentsRepository; AgentsRepository agentsRepository;
...@@ -276,12 +280,25 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -276,12 +280,25 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override @Override
public ResultDTO getCall(CampaignRequestDTO dto) { public ResultDTO getCall(CampaignRequestDTO dto) {
ResultDTO result = new ResultDTO(); ResultDTO result = new ResultDTO();
Map data = new HashMap();
data.put("campaignId", dto.getCampaignId());
Agents agents = agentsRepository.findByAgentId(dto.getAgentId()); //Agents agents = agentsRepository.findByAgentId(dto.getAgentId());
TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getCompanySiteId())); //TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getCompanySiteId()));
TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getCompanySiteId())); //TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getCompanySiteId()));
List<CampaignCustomer> lst = null;//campaignCustomerRepository.getCustomerRecallDate(dto.getCampaignId(), dto.getAgentId(), dto.getCompanySiteId(), );
if (lst != null) {
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
//result.setTotalRow(count);
//result.setListData(campaignExecuteRepository.searchCampaignExecute(requestDto, SQLBuilder.buildPageable(requestDto)));
//result.setData(data);
} else {
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR);
}
return result; return result;
} }
......
...@@ -58,8 +58,8 @@ public class ApParamController { ...@@ -58,8 +58,8 @@ public class ApParamController {
@GetMapping(path = "/findAllParam") @GetMapping(path = "/findAllParam")
@ResponseBody @ResponseBody
public ResponseEntity findAllParam() { public ResponseEntity findAllParam(@RequestParam("parType") String parType) {
List<ApParam> findAll = apParamService.findAllParam(); List<ApParam> findAll = apParamService.findAllParam(parType);
if(findAll.isEmpty()) { if(findAll.isEmpty()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT); return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment