Commit 33f54075 authored by ='s avatar =

Merge remote-tracking branch 'origin/master'

parents 71c639f7 dfc637fe
......@@ -13,28 +13,26 @@ import java.util.List;
@Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface CampaignCustomerRepository extends JpaRepository<CampaignCustomer, Long>, CampaignCustomerRepositoryCustom {
@Query(value = "SELECT COUNT(*) " +
" FROM CAMPAIGN_CUSTOMER CC " +
" JOIN CAMPAIGN C ON CC.CAMPAIGN_ID = C.CAMPAIGN_ID " +
" LEFT JOIN CAMPAIGN_COMPLETE_CODE CCC ON CC.STATUS = CCC.COMPLETE_VALUE" +
" WHERE CC.COMPANY_SITE_ID = :companySiteId " +
" AND CC.AGENT_ID = :agentId" +
" AND C.STATUS = 2 " +
" AND CC.RECALL_TIME <= SYSDATE " +
" AND CCC.IS_RECALL = 1", nativeQuery = true)
Long countRecallCustomer(@Param("companySiteId") Long pCompanySiteId, @Param("agentId") Long agentId);
@Query(value = "SELECT COUNT(*) " +
"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 ",
nativeQuery = true)
"WHERE CC.CAMPAIGN_ID = :campaignId " +
"AND CC.CUSTOMER_ID = :customerId " +
"AND CC.STATUS = 3 " +
"AND CCC.IS_RECALL = 1 " +
"AND CCC.STATUS = 1 ", nativeQuery = true)
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);
CampaignCustomer findCampaignCustomerByCampaignCustomerId(Long id);
}
......@@ -36,4 +36,7 @@ public interface CampaignExecuteService {
ResultDTO callCustomer(ContactCustResultDTO dto);
ResultDTO countRecallCustomer(Long companySiteId, Long agentId);
ResultDTO getCustomerRecall(Long campaignId, Long customerId);
}
......@@ -30,8 +30,6 @@ public interface CampaignService {
ResultDTO addNewCampaign(CampaignDTO campaignDTO);
Map countRecallCustomer(Long companySiteId, Long agentId);
ResultDTO findCampaignById(Long campaignId);
ResultDTO changeCampaignStatus(CampaignDTO dto);
......@@ -57,4 +55,5 @@ public interface CampaignService {
ResultDTO getListFieldsToShow(CampaignRequestDTO dto);
//</editor-fold>
}
......@@ -495,4 +495,38 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return result;
}
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO countRecallCustomer(Long companySiteId, Long agentId) {
Long count = campaignCustomerRepository.countRecallCustomer(companySiteId, agentId);
ResultDTO resultDTO = new ResultDTO();
if (count != null) {
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(count);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
resultDTO.setData(0);
}
return resultDTO;
}
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCustomerRecall(Long campaignId, Long customerId) {
Long count = campaignCustomerRepository.getCustomerRecall(campaignId, customerId);
ResultDTO resultDTO = new ResultDTO();
if (count != null) {
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(count);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
resultDTO.setData(0);
}
return resultDTO;
}
}
......@@ -171,26 +171,6 @@ public class CampaignServiceImpl implements CampaignService {
return resultDTO;
}
@Transactional(DataSourceQualify.CCMS_FULL)
public Map countRecallCustomer(Long companySiteId, Long agentId) {
Map result = new HashMap();
Long count = campaignRepository.countRecallCustomer(companySiteId, agentId);
ResultDTO resultDTO = new ResultDTO();
if (count != null) {
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.put("info", resultDTO);
result.put("result", count);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
result.put("info", resultDTO);
result.put("result", 0);
}
return result;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO findCampaignById(Long campaignId) {
......
......@@ -96,13 +96,6 @@ public class CampaignController {
return campaignService.addNewCampaign(dto);
}
@GetMapping("/countRecallCustomer")
@ResponseBody
public ResponseEntity countRecallCustomer(@RequestParam("companySiteId") Long companySiteId, @RequestParam("agentId") Long agentId) {
Map result = campaignService.countRecallCustomer(companySiteId, agentId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@GetMapping("/findByCampaignId")
@ResponseBody
public ResponseEntity findByCampaignId(@RequestParam("campaignId") Long campaignId) {
......@@ -240,4 +233,18 @@ public class CampaignController {
ResultDTO resultDTO = campaignService.getListFieldsToShow(dto);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@GetMapping("/countRecallCustomer")
@ResponseBody
public ResponseEntity countRecallCustomer(@RequestParam("companySiteId") Long companySiteId, @RequestParam("agentId") Long agentId) {
ResultDTO result = campaignExecuteService.countRecallCustomer(companySiteId, agentId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@GetMapping("/getCustomerRecall")
@ResponseBody
public ResponseEntity getCustomerRecall(@RequestParam("campaignId") Long campaignId, @RequestParam("customerId") Long customerId) {
ResultDTO result = campaignExecuteService.getCustomerRecall(campaignId, customerId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
}
server:
port: 9999
port: 1111
spring:
application:
name: campaign
......
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