Commit 8244d79c authored by Tu Bach's avatar Tu Bach

Merge branch 'master' into tubn

parents 6264ccd9 dfc637fe
......@@ -49,8 +49,8 @@
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>-->
<version>1.0</version>
</dependency>
<dependency>
......
......@@ -31,27 +31,27 @@ public class CorsFilter implements Filter {
HttpServletRequest request = (HttpServletRequest) req;
// chain.doFilter(req, resp);
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
chain.doFilter(req, resp);
return;
}
if ("/".equals(request.getRequestURI())) {
chain.doFilter(req, resp);
return;
}
String xAuthToken = request.getHeader("X-Auth-Token");
if (xAuthToken == null || "".equals(xAuthToken)) {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
return;
}
Object obj = RedisUtil.getInstance().get(xAuthToken);
if (obj instanceof UserSession) {
chain.doFilter(req, resp);
} else {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
}
chain.doFilter(req, resp);
// if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
// chain.doFilter(req, resp);
// return;
// }
// if ("/".equals(request.getRequestURI())) {
// chain.doFilter(req, resp);
// return;
// }
// String xAuthToken = request.getHeader("X-Auth-Token");
// if (xAuthToken == null || "".equals(xAuthToken)) {
// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
// return;
// }
// Object obj = RedisUtil.getInstance().get(xAuthToken);
// if (obj instanceof UserSession) {
// chain.doFilter(req, resp);
// } else {
// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
// }
}
@Override
......
......@@ -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);
}
......@@ -159,7 +159,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb.append(" AND a.CUSTOMER_NUMBER <= :p_cusNumTo");
}
sb.append(" ORDER BY a.START_TIME DESC ");
sb.append(" ORDER BY a.CREATE_TIME DESC ");
SQLQuery query = session.createSQLQuery(sb.toString());
if (!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) {
......
......@@ -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;
}
}
......@@ -170,26 +170,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) {
......@@ -163,7 +156,7 @@ public class CampaignController {
return new ResponseEntity<byte[]>(contentReturn, headers, HttpStatus.OK);
}
@RequestMapping(value = "/changeCampaignStatus", method = RequestMethod.PUT)
@RequestMapping(value = "/changeCampaignStatus", method = RequestMethod.POST)
public ResultDTO changeCampaignStatus(@RequestBody CampaignDTO dto, HttpServletRequest request) {
dto.setSessionId(request.getSession().getId());
return campaignService.changeCampaignStatus(dto);
......@@ -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