Commit 7cdb69ac authored by Vu Duy Anh's avatar Vu Duy Anh

anhvd commit TimeRangedial + TimeZoneDial

parents 52b3bc98 6b55d2d4
package com.viettel.campaign.model;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Entity
@Table(name = "CAMPAIGN_CUSTOMER")
@Getter
@Setter
public class CampaignCustomer {
@Id
@Basic(optional = false)
@NotNull
@Column(name = "CAMPAIGN_CUSTOMERLIST_ID")
private Long campaignCustomerListId;
@Column(name = "CAMPAIGN_ID")
private Long campaignId;
@Column(name = "CUSTOMER_ID")
private Long customerId;
@Column(name = "STATUS")
private Short status;
@Column(name = "AGENT_ID")
private Long agentId;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "RECALL_TIME")
private Date recallTime;
@Column(name = "RECALL_COUNT")
private Long recallCount = 0L;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "CALL_TIME")
private Date callTime;
@Column(name = "CUSTOMER_LIST_ID")
private Long customerListId;
@Column(name = "IN_CAMPAIGN_STATUS")
private Short inCampaignStatus;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "SEND_TIME")
private Date sendTime;
@Column(name = "PROCESS_STATUS")
private Short processStatus = 0;
@Column(name = "CONTACT_STATUS")
private Short contactStatus;
@Column(name = "REDISTRIBUTE")
private Short redistribute;
@Column(name = "SESSION_ID")
private String sessionId;
@Column(name = "CALL_STATUS")
private Long callStatus;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "COMPLAIN_ID")
private Long complainId;
}
...@@ -2,8 +2,18 @@ package com.viettel.campaign.repository; ...@@ -2,8 +2,18 @@ package com.viettel.campaign.repository;
import com.viettel.campaign.model.Campaign; import com.viettel.campaign.model.Campaign;
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.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@Repository @Repository
public interface CampaignRepository extends JpaRepository<Campaign, Long>, CampaignRepositoryCustom { public interface CampaignRepository extends JpaRepository<Campaign, Long>, CampaignRepositoryCustom {
@Query("SELECT COUNT(c.campaignId) " +
" FROM Campaign c JOIN CampaignCustomer cc ON c.campaignId = cc.campaignId " +
" WHERE cc.companySiteId = :pCompanySiteId " +
" AND cc.status = 1 " +
" AND cc.recallTime <= sysdate " +
" AND cc.agentId = :pAgentId")
Long countRecallCustomer(@Param("pCompanySiteId") Long pCompanySiteId, @Param("pAgentId") Long pAgentId);
} }
package com.viettel.campaign.repository; package com.viettel.campaign.repository;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ResultDTO; import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO; import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
@Repository @Repository
public interface CampaignRepositoryCustom { public interface CampaignRepositoryCustom {
List<CampaignDTO> searchCampaignExecute(String agentId, Pageable pageable); ResultDTO searchCampaignExecute(CampaignRequestDTO campaignRequestDto);
ResultDTO search(CampaignRequestDTO requestDto); ResultDTO search(CampaignRequestDTO requestDto);
ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO); ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO);
} }
...@@ -34,22 +34,100 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -34,22 +34,100 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
EntityManager entityManager; EntityManager entityManager;
@Override @Override
public List<CampaignDTO> searchCampaignExecute(String agentId, Pageable pageable) { public ResultDTO searchCampaignExecute(CampaignRequestDTO campaignRequestDto) {
ResultDTO result = new ResultDTO();
List<CampaignDTO> lst = new ArrayList<>(); List<CampaignDTO> lst = new ArrayList<>();
String expression = new StringBuilder() StringBuilder expression = new StringBuilder()
.append(" SELECT C.CAMPAIGN_ID, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS ") .append(" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS ")
//.append(" SELECT CAMPAIGN_COMPLETE_CODE_ID AS CAMPAIGN_ID, COMPLETE_NAME AS CAMPAIGN_NAME, DESCRIPTION AS CONTENT, UPDATE_BY AS START_TIME, UPDATE_BY AS END_TIME, STATUS ") .append(" FROM CAMPAIGN C INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID ")
.append(" FROM CAMPAIGN C ")
.append(" INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID ")
.append(" WHERE 1 = 1 ") .append(" WHERE 1 = 1 ")
//.append(" AND CA.AGENT_ID = :pAgentId ") //.append(" AND CA.AGENT_ID = :pAgentId ")
.append(" AND C.STATUS IN (2,3) ") .append(" AND C.STATUS IN (2,3) ");
.toString();
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode())) {
expression.append(" AND C.CAMPAIGN_ID IN (:pCampaingId) ");
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignName())) {
expression.append(" AND UPPER(C.CAMPAIGN_NAME) LIKE CONCAT('%',:pCampaignName,'%') ");
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getStatus().longValue())) {
if (campaignRequestDto.getStatus() != 0)
expression.append(" AND C.STATUS = :pStatus ");
else
expression.append(" AND C.STATUS IN (1, 2, 3) ");
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getFromDateFr())) {
expression.append(" AND TRUNC(C.START_TIME) >= TRUNC(:pStartTimeFr) ");
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getFromDateTo())) {
expression.append(" AND TRUNC(C.START_TIME) <= TRUNC(:pStartTimeTo) ");
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getToDateFr())) {
expression.append(" AND TRUNC(C.END_TIME) >= TRUNC(:pEndTimeFr) ");
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getToDateTo())) {
expression.append(" AND TRUNC(C.END_TIME) <= TRUNC(:pEndTimeTo) ");
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getNumOfCusFr())) {
expression.append(" AND C.CUSTOMER_NUMBER >= :pCustNumFr ");
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getNumOfCusTo())) {
expression.append(" AND C.CUSTOMER_NUMBER <= :pCustNumTo ");
}
try { try {
Query query = entityManager.createNativeQuery(expression); Query query = entityManager.createNativeQuery(expression.toString());
//query.setParameter("pAgentId", agentId); //query.setParameter("pAgentId", campaignRequestDto.getAgentId());
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode())) {
String[] lstCode = campaignRequestDto.getCampaignCode().split(",");
query.setParameter(":pCampaingId", lstCode);
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignName())) {
query.setParameter(":pCampaignName", campaignRequestDto.getCampaignName().toUpperCase());
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getStatus().longValue())) {
if (campaignRequestDto.getStatus() != 0)
query.setParameter(":pStatus", campaignRequestDto.getStatus());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getFromDateFr())) {
query.setParameter(":pStartTimeFr", campaignRequestDto.getFromDateFr());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getFromDateTo())) {
query.setParameter(":pStartTimeTo", campaignRequestDto.getFromDateTo());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getToDateFr())) {
query.setParameter(":pEndTimeFr", campaignRequestDto.getToDateFr());
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getToDateTo())) {
query.setParameter(":pEndTimeTo", campaignRequestDto.getToDateTo());
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getNumOfCusFr())) {
query.setParameter(":pCustNumFr", campaignRequestDto.getNumOfCusFr());
}
if (!DataUtil.isNullOrZero(campaignRequestDto.getNumOfCusTo())) {
query.setParameter(":pCustNumTo", campaignRequestDto.getNumOfCusTo());
}
result.setTotalRow(query.getResultList().size());
Pageable pageable = SQLBuilder.buildPageable(campaignRequestDto);
if (pageable != null) { if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize()); query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize()); query.setMaxResults(pageable.getPageSize());
...@@ -59,7 +137,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -59,7 +137,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
for (Object[] obj : data) { for (Object[] obj : data) {
CampaignDTO item = new CampaignDTO(); CampaignDTO item = new CampaignDTO();
item.setCampaignId((BigDecimal) obj[0]); item.setPage(campaignRequestDto.getPage());
item.setPageSize(campaignRequestDto.getPageSize());
item.setSort(campaignRequestDto.getSort());
item.setCampaignCode((String) obj[0]);
item.setCampaignName((String) obj[1]); item.setCampaignName((String) obj[1]);
item.setContent((String) obj[2]); item.setContent((String) obj[2]);
item.setStartTime((Date) obj[3]); item.setStartTime((Date) obj[3]);
...@@ -69,12 +150,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -69,12 +150,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
lst.add(item); lst.add(item);
} }
return lst; result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setListData(lst);
return result;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
return lst; return result;
} }
@Override @Override
...@@ -87,7 +172,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -87,7 +172,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
Session session = sessionFactory.openSession(); Session session = sessionFactory.openSession();
session.beginTransaction(); session.beginTransaction();
if(DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) { if (DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) {
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
return result; return result;
...@@ -203,7 +288,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -203,7 +288,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if (list.size() > 0) { if (list.size() > 0) {
count = query.list().size(); count = query.list().size();
} }
Pageable pageable = buildPageable(requestDto); Pageable pageable = SQLBuilder.buildPageable(requestDto);
if (pageable != null) { if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize()); query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize()); query.setMaxResults(pageable.getPageSize());
...@@ -232,7 +317,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -232,7 +317,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
Session session = sessionFactory.openSession(); Session session = sessionFactory.openSession();
session.beginTransaction(); session.beginTransaction();
if(DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) { if (DataUtil.isNullOrEmpty(requestDto.getCompanySiteId())) {
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
return result; return result;
...@@ -247,13 +332,13 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -247,13 +332,13 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
" STATUS status " + " STATUS status " +
" FROM CAMPAIGN" + " FROM CAMPAIGN" +
" WHERE COMPANY_SITE_ID = :p_company_site_id AND STATUS <> -1 "); " WHERE COMPANY_SITE_ID = :p_company_site_id AND STATUS <> -1 ");
if(!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) { if (!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) {
sqlStr.append(" AND CAMPAIGN_CODE LIKE :p_code "); sqlStr.append(" AND CAMPAIGN_CODE LIKE :p_code ");
} }
sqlStr.append(" ORDER BY START_TIME DESC "); sqlStr.append(" ORDER BY START_TIME DESC ");
SQLQuery query = session.createSQLQuery(sqlStr.toString()); SQLQuery query = session.createSQLQuery(sqlStr.toString());
query.setParameter("p_company_site_id", requestDto.getCompanySiteId()); query.setParameter("p_company_site_id", requestDto.getCompanySiteId());
if(!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) { if (!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) {
query.setParameter("p_code", "%" + query.setParameter("p_code", "%" +
requestDto.getCampaignCode().toUpperCase() requestDto.getCampaignCode().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
...@@ -274,7 +359,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -274,7 +359,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if (list.size() > 0) { if (list.size() > 0) {
count = query.list().size(); count = query.list().size();
} }
Pageable pageable = buildPageable(requestDto); Pageable pageable = SQLBuilder.buildPageable(requestDto);
if (pageable != null) { if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize()); query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize()); query.setMaxResults(pageable.getPageSize());
...@@ -284,7 +369,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -284,7 +369,10 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
result.setData(dataPage); result.setData(dataPage);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS); result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
}catch (Exception ex) { session.close();
return result;
} catch (Exception ex) {
logger.error(ex.getMessage(), ex); logger.error(ex.getMessage(), ex);
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
...@@ -294,15 +382,4 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -294,15 +382,4 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return result; return result;
} }
private Pageable buildPageable(CampaignRequestDTO obj) {
Pageable pageable = null;
if (DataUtil.isNullOrEmpty(obj.getSort())) {
pageable = new PageRequest(obj.getPage(), obj.getPageSize(), null);
} else {
String[] sorts = obj.getSort().split(",");
Sort sort = new Sort(Sort.Direction.fromString(sorts[1]), sorts[0]);
pageable = new PageRequest(obj.getPage(), obj.getPageSize(), sort);
}
return pageable;
}
} }
...@@ -7,11 +7,13 @@ import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO; ...@@ -7,11 +7,13 @@ import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import java.util.Map; import java.util.Map;
public interface CampaignService { public interface CampaignService {
Map searchCampaignExecute(int page, int pageSize, String sort, String agentId); ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto);
ResultDTO search(CampaignRequestDTO requestDto); ResultDTO search(CampaignRequestDTO requestDto);
ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO); ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO);
ResultDTO addNewCampaign(CampaignDTO campaignDTO); ResultDTO addNewCampaign(CampaignDTO campaignDTO);
Map countRecallCustomer(Long companySiteId, Long agentId);
} }
...@@ -12,15 +12,10 @@ import org.apache.logging.log4j.LogManager; ...@@ -12,15 +12,10 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Service @Service
...@@ -35,17 +30,8 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -35,17 +30,8 @@ public class CampaignServiceImpl implements CampaignService {
ModelMapper modelMapper; ModelMapper modelMapper;
@Override @Override
public Map searchCampaignExecute(int page, int pageSize, String sort, String agentId) { public ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto) {
Map result = new HashMap(); return campaignRepository.searchCampaignExecute(requestDto);
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
List<CampaignDTO> lst = campaignRepository.searchCampaignExecute(agentId, pageable);
List<CampaignDTO> count = campaignRepository.searchCampaignExecute(agentId, null);
result.put("totalItem", count.size());
result.put("data", lst);
return result;
} }
@Override @Override
...@@ -76,4 +62,23 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -76,4 +62,23 @@ public class CampaignServiceImpl implements CampaignService {
} }
return resultDTO; return resultDTO;
} }
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;
}
} }
...@@ -3,7 +3,13 @@ import java.io.File; ...@@ -3,7 +3,13 @@ import java.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.io.IOException; import java.io.IOException;
import com.viettel.campaign.web.dto.BaseDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
/** /**
* @author anhvd_itsol * @author anhvd_itsol
...@@ -30,4 +36,16 @@ public class SQLBuilder { ...@@ -30,4 +36,16 @@ public class SQLBuilder {
} }
return null; return null;
} }
public static Pageable buildPageable(BaseDTO obj) {
Pageable pageable = null;
if (DataUtil.isNullOrEmpty(obj.getSort())) {
pageable = PageRequest.of(obj.getPage(), obj.getPageSize(), null);
} else {
String[] sorts = obj.getSort().split(",");
Sort sort = new Sort(Sort.Direction.fromString(sorts[1]), sorts[0]);
pageable = PageRequest.of(obj.getPage(), obj.getPageSize(), sort);
}
return pageable;
}
} }
package com.viettel.campaign.web.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class CampaignCustomerDTO {
private Long campaignCustomerListId;
private Long campaignId;
private Long customerId;
private Short status;
private Long agentId;
private Date recallTime;
private Long recallCount = 0L;
private Date callTime;
private Long customerListId;
private Short inCampaignStatus;
private Date sendTime;
private Short processStatus = 0;
private Short contactStatus;
private Short redistribute;
private String sessionId;
private Long callStatus;
private Long companySiteId;
private Long complainId;
}
...@@ -13,4 +13,5 @@ public class ResultDTO { ...@@ -13,4 +13,5 @@ public class ResultDTO {
private String description; private String description;
private List<?> listData = new ArrayList(); private List<?> listData = new ArrayList();
private Object data; private Object data;
private int totalRow = 0;
} }
...@@ -8,7 +8,6 @@ import lombok.Setter; ...@@ -8,7 +8,6 @@ import lombok.Setter;
* @author anhvd_itsol * @author anhvd_itsol
*/ */
@Getter @Getter
@Setter @Setter
public class CampaignRequestDTO extends BaseDTO { public class CampaignRequestDTO extends BaseDTO {
...@@ -24,5 +23,6 @@ public class CampaignRequestDTO extends BaseDTO { ...@@ -24,5 +23,6 @@ public class CampaignRequestDTO extends BaseDTO {
Short type; Short type;
Short chanel; Short chanel;
String companySiteId; String companySiteId;
String agentId;
String types; String types;
} }
...@@ -21,10 +21,10 @@ public class CampaignController { ...@@ -21,10 +21,10 @@ public class CampaignController {
@Autowired @Autowired
CampaignService campaignService; CampaignService campaignService;
@GetMapping("/searchCampaignExecute") @RequestMapping("/searchCampaignExecute")
@ResponseBody @ResponseBody
public ResponseEntity searchCampaignExecute(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("agentId") String agentId) { public ResponseEntity<ResultDTO> searchCampaignExecute(@RequestBody CampaignRequestDTO requestDto) {
Map result = campaignService.searchCampaignExecute(page, pageSize, sort, agentId); ResultDTO result = campaignService.searchCampaignExecute(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
...@@ -44,4 +44,10 @@ public class CampaignController { ...@@ -44,4 +44,10 @@ public class CampaignController {
return campaignService.findByCampaignCode(dto); return campaignService.findByCampaignCode(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);
}
} }
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