Commit e4b1cb40 authored by ='s avatar =

Merge remote-tracking branch 'origin/master'

parents 8b671664 727d88c2
......@@ -75,7 +75,6 @@ public class Campaign implements Serializable {
private String dayOfWeek;
@Column(name = "CURRENT_TIME_MODE")
private Long currentTimeMode;
private Long currentTimeModel;
@Column(name = "WRAPUP_TIME_CONNECT")
private Long wrapupTimeConnect;
@Column(name = "WRAPUP_TIME_DISCONNECT")
......
......@@ -43,6 +43,6 @@ public interface CampaignCompleteCodeRepository extends JpaRepository<CampaignCo
@Query(value = "FROM CampaignCompleteCode WHERE status = 1 AND completeValue = :completeValue AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCompleteCode> getCustomerStatus(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
@Query(value = "FROM CampaignCompleteCode WHERE status = 1 AND completeValue = :completeValue AND completeType <> :completeType AND companySiteId = :companySiteId")
List<CampaignCompleteCode> getCustomerStatusWithoutType(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
@Query(value = "FROM CampaignCompleteCode WHERE status = 1 AND completeValue <> :completeValue AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCompleteCode> getCustomerStatusWithoutValue(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
}
......@@ -10,7 +10,7 @@ import java.util.Date;
import java.util.List;
@Repository
public interface CampaignRepository extends JpaRepository<Campaign, Long>, CampaignRepositoryCustom {
public interface CampaignRepository extends JpaRepository<Campaign, Long> {
List<Campaign> findAllByCompanySiteId(Long companyId);
......
......@@ -288,7 +288,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query.addScalar("customerNumber", new LongType());
query.addScalar("status", new ShortType());
query.addScalar("numOfJoinedCus", new LongType());
query.addScalar("numOfNotJoinedCus", new LongType());
query.addScalar("numOfInteractedCus", new LongType());
query.addScalar("numOfNotInteractedCus", new LongType());
query.addScalar("numOfLockCus", new LongType());
query.addScalar("companySiteId", new LongType());
query.addScalar("content", new StringType());
......@@ -305,14 +306,19 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if (list.size() > 0) {
count = query.list().size();
}
Pageable pageable = SQLBuilder.buildPageable(requestDto);
if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize());
if(requestDto.getPage() != null && requestDto.getPageSize() != null) {
Pageable pageable = SQLBuilder.buildPageable(requestDto);
if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize());
}
List<CampaignDTO> data = query.list();
Page<CampaignDTO> dataPage = new PageImpl<>(data, pageable, count);
result.setData(dataPage);
}else {
List<CampaignDTO> dataExport = query.list();
result.setData(dataExport);
}
List<CampaignDTO> data = query.list();
Page<CampaignDTO> dataPage = new PageImpl<>(data, pageable, count);
result.setData(dataPage);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception ex) {
......
......@@ -4,6 +4,7 @@ import com.viettel.campaign.model.ccms_full.Campaign;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Date;
import java.util.List;
......@@ -35,4 +36,6 @@ public interface CampaignService {
ResultDTO changeCampaignStatus(CampaignDTO dto);
ResultDTO checkAllowStatusToPrepare(Long campaignId);
XSSFWorkbook exportCampaigns(CampaignRequestDTO dto);
}
......@@ -281,7 +281,7 @@ public class CampaignCompleteCodeServiceImpl implements CampaignCompleteCodeServ
public ResultDTO getListStatusWithoutType(String completeValue, Short completeType, Long companySiteId) {
ResultDTO resultDTO = new ResultDTO();
try {
List<CampaignCompleteCode> list = completeCodeRepository.getCustomerStatusWithoutType(completeValue, completeType, companySiteId);
List<CampaignCompleteCode> list = completeCodeRepository.getCustomerStatusWithoutValue(completeValue, completeType, companySiteId);
resultDTO.setListData(list);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
......
package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.ApParam;
import com.viettel.campaign.model.ccms_full.Campaign;
import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
//import com.viettel.campaign.model.UserActionLog;
import com.viettel.campaign.repository.ccms_full.CampaignRepository;
import com.viettel.campaign.repository.ccms_full.TimeRangeDialModeRepository;
import com.viettel.campaign.repository.ccms_full.TimeZoneDialModeRepository;
import com.viettel.campaign.repository.ccms_full.*;
//import com.viettel.campaign.repository.UserActionLogRepository;
import com.viettel.campaign.repository.ccms_full.UserActionLogRepositoryCustom;
import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.utils.BundleUtils;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.utils.WorkBookBuilder;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -32,9 +36,15 @@ import java.util.*;
public class CampaignServiceImpl implements CampaignService {
private static final Logger logger = LogManager.getLogger(CampaignServiceImpl.class);
public static String CAMPAIGN_TYPE = "CAMPAIGN_TYPE";
public static String CAMPAIGN_STATUS = "CAMPAIGN_STATUS";
@Autowired
CampaignRepository campaignRepository;
@Autowired
CampaignRepositoryCustom campaignRepositoryCustom;
@Autowired
TimeZoneDialModeRepository timeZoneDialModeRepository;
......@@ -47,22 +57,25 @@ public class CampaignServiceImpl implements CampaignService {
@Autowired
ModelMapper modelMapper;
@Autowired
ApParamRepository apParamRepository;
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto) {
return campaignRepository.searchCampaignExecute(requestDto);
return campaignRepositoryCustom.searchCampaignExecute(requestDto);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO search(CampaignRequestDTO requestDto) {
return campaignRepository.search(requestDto);
return campaignRepositoryCustom.search(requestDto);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO findByCampaignCode(CampaignRequestDTO requestDTO) {
return campaignRepository.findByCampaignCode(requestDTO);
return campaignRepositoryCustom.findByCampaignCode(requestDTO);
}
@Override
......@@ -97,11 +110,11 @@ public class CampaignServiceImpl implements CampaignService {
if (campaign != null) {
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setErrorCode(Constants.ApiErrorDesc.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(campaign);
} else {
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setErrorCode(Constants.ApiErrorDesc.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR);
}
return result;
......@@ -249,12 +262,85 @@ public class CampaignServiceImpl implements CampaignService {
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO checkAllowStatusToPrepare(Long campaignId) {
return campaignRepository.checkAllowStatusToPrepare(campaignId);
return campaignRepositoryCustom.checkAllowStatusToPrepare(campaignId);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public XSSFWorkbook exportCampaigns(CampaignRequestDTO dto) {
Locale locale = Locale.forLanguageTag("vi");
ResultDTO resultDTO = campaignRepositoryCustom.search(dto);
List<CampaignDTO> listData = (List<CampaignDTO>) resultDTO.getData();
List<ApParam> lstType = apParamRepository.findParamByParType(CAMPAIGN_TYPE);
XSSFWorkbook workbook = new XSSFWorkbook();
Sheet sheet;
CellStyle styleTitle = WorkBookBuilder.buildDefaultStyleTitle(workbook);
CellStyle styleRowHeader = WorkBookBuilder.buildDefaultStyleRowHeader(workbook);
CellStyle styleRow = WorkBookBuilder.buildDefaultStyleRow(workbook);
// list header
List<String> fileHeaderList = new ArrayList<>();
fileHeaderList.add(BundleUtils.getLangString("stt", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.code", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.name", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.type", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.chanel", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.startTime", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.endTime", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.cusNum", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.joinedCusNum", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.interactedCusNum", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.notInteractedCusNum", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.logCusNum", locale));
fileHeaderList.add(BundleUtils.getLangString("campaign.status", locale));
//
String sheetName = BundleUtils.getLangString("campaign", locale);
sheet = workbook.createSheet(sheetName);
// Title
String title = BundleUtils.getLangString("campaign.title", locale);
int rowTitleStart = 3;
Row rowTitle = sheet.createRow(rowTitleStart);
rowTitle.setHeight((short) 800);
WorkBookBuilder.writeCellContent(rowTitle, styleTitle, 3, title);
sheet.addMergedRegion(new CellRangeAddress(rowTitleStart, rowTitleStart, 3, 8));
// Header
int startRowTable = 5;
int count = 1;
Row rowHeader = sheet.createRow(startRowTable);
for (int i = 0; i < fileHeaderList.size(); i++) {
WorkBookBuilder.writeCellContent(rowHeader, styleRowHeader, i, fileHeaderList.get(i));
}
// Content
for (int i = 0, rowIndex = 1; i < listData.size(); i++) {
Row row = sheet.createRow(startRowTable + count);
int col = 0;
WorkBookBuilder.writeCellContent(row, styleRow, col++, rowIndex);
WorkBookBuilder.writeCellContent(row, styleRow, col++, listData.get(i).getCampaignCode());
WorkBookBuilder.writeCellContent(row, styleRow, col++, listData.get(i).getCampaignName());
WorkBookBuilder.writeCellContent(row, styleRow, col++, getCampaignTypeName(lstType, listData.get(i).getCampaignType()));
WorkBookBuilder.writeCellContent(row, styleRow, col++, DataUtil.isNullOrZero(listData.get(i).getChanel()) ? "" : BundleUtils.getLangString("campaign.chanel." + listData.get(i).getChanel(), locale));
WorkBookBuilder.writeCellContent(row, styleRow, col++, listData.get(i).getStartTime());
WorkBookBuilder.writeCellContent(row, styleRow, col++, listData.get(i).getEndTime());
WorkBookBuilder.writeCellContent(row, styleRow, col++, DataUtil.isNullOrZero(listData.get(i).getCustomerNumber()) ? 0 : listData.get(i).getCustomerNumber());
WorkBookBuilder.writeCellContent(row, styleRow, col++, DataUtil.isNullOrZero(listData.get(i).getNumOfJoinedCus()) ? 0 : listData.get(i).getNumOfJoinedCus());
WorkBookBuilder.writeCellContent(row, styleRow, col++, DataUtil.isNullOrZero(listData.get(i).getNumOfInteractedCus()) ? 0 : listData.get(i).getNumOfInteractedCus());
WorkBookBuilder.writeCellContent(row, styleRow, col++, DataUtil.isNullOrZero(listData.get(i).getNumOfNotInteractedCus()) ? 0 : listData.get(i).getNumOfNotInteractedCus());
WorkBookBuilder.writeCellContent(row, styleRow, col++, DataUtil.isNullOrZero(listData.get(i).getNumOfLockCus()) ? 0 : listData.get(i).getNumOfLockCus());
WorkBookBuilder.writeCellContent(row, styleRow, col++, listData.get(i).getStatus() == null ? "" : BundleUtils.getLangString("campaign.status." + listData.get(i).getStatus(), locale));
++rowIndex;
++count;
}
return workbook;
}
private String generateCampaignCode(String campaignType, Short chanel) {
int year = Calendar.getInstance().get(Calendar.YEAR);
String maxIndexStr = campaignRepository.getMaxCampaignIndex();
String maxIndexStr = campaignRepositoryCustom.getMaxCampaignIndex();
if (maxIndexStr != null) {
Long maxIndex = Long.valueOf(maxIndexStr) + 1;
String result = campaignType + "_" + chanel + "_" + year + "_" + maxIndex.toString();
......@@ -262,4 +348,17 @@ public class CampaignServiceImpl implements CampaignService {
}
return null;
}
public String getCampaignTypeName(List<ApParam> lstApParams, String type) {
String name = "";
if(!DataUtil.isNullOrEmpty(type)) {
for(int i = 0; i < lstApParams.size(); i++) {
if(type.equals(lstApParams.get(i).getParValue())) {
name = lstApParams.get(i).getParName();
break;
}
}
}
return name;
}
}
......@@ -270,4 +270,5 @@ public class DataUtil {
public static boolean isNullOrZero(Short value) {
return (value == null || value.equals(Short.parseShort("0")));
}
public static boolean isNullOrZero(Integer value) { return (value == null || value.equals(Integer.parseInt("0"))); }
}
package com.viettel.campaign.utils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/**
* @author anhvd_itsol
*/
public class WorkBookBuilder {
public static Font buildDefaultFont(XSSFWorkbook workbook) {
Font defaultFont = workbook.createFont();
defaultFont.setFontHeightInPoints((short) 13);
defaultFont.setFontName("Times New Roman");
defaultFont.setColor(IndexedColors.BLACK.getIndex());
return defaultFont;
}
public static Font buildDefaultTitleFont(XSSFWorkbook workbook) {
Font titleFont = workbook.createFont();
titleFont.setFontHeightInPoints((short) 18);
titleFont.setFontName("Times New Roman");
titleFont.setColor(IndexedColors.BLACK.getIndex());
titleFont.setBold(true);
return titleFont;
}
public static Font buildDefaultHeaderFont(XSSFWorkbook workbook) {
Font headerFont = workbook.createFont();
headerFont.setFontHeightInPoints((short) 13);
headerFont.setFontName("Times New Roman");
headerFont.setColor(IndexedColors.BLACK.getIndex());
headerFont.setBold(true);
return headerFont;
}
public static CellStyle buildDefaultStyleTitle(XSSFWorkbook workbook) {
CellStyle styleTitle = workbook.createCellStyle();
styleTitle.setFont(buildDefaultTitleFont(workbook));
styleTitle.setAlignment(HorizontalAlignment.CENTER);
return styleTitle;
}
public static CellStyle buildDefaultStyleRowHeader(XSSFWorkbook workbook) {
CellStyle styleRowHeader = workbook.createCellStyle();
styleRowHeader.setFont(buildDefaultHeaderFont(workbook));
styleRowHeader.setAlignment(HorizontalAlignment.CENTER);
styleRowHeader.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
styleRowHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleRowHeader.setBorderRight(BorderStyle.THIN);
styleRowHeader.setRightBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderBottom(BorderStyle.THIN);
styleRowHeader.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderLeft(BorderStyle.THIN);
styleRowHeader.setLeftBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderTop(BorderStyle.THIN);
styleRowHeader.setTopBorderColor(IndexedColors.BLACK.getIndex());
return styleRowHeader;
}
public static CellStyle buildDefaultStyleRow(XSSFWorkbook workbook) {
CellStyle styleRow = workbook.createCellStyle();
styleRow.setFont(buildDefaultFont(workbook));
return styleRow;
}
public static void writeCellContent(Row row, CellStyle rowStyle, int colNo, Object content) {
Cell cell = row.createCell(colNo);
if (content == null) {
cell.setCellValue("");
} else {
cell.setCellValue(String.valueOf(content));
}
cell.setCellStyle(rowStyle);
}
}
......@@ -10,8 +10,8 @@ import java.io.Serializable;
public class BaseDTO implements Serializable {
protected String keySet;
protected int pageSize;
protected int page;
protected Integer pageSize;
protected Integer page;
protected String sort;
protected String langKey;
}
......@@ -55,7 +55,6 @@ public class CampaignDTO extends BaseDTO {
private Integer timeWaitAgent;
private Long questIndex;
private Long numOfJoinedCus;
private Long numOfNotJoinedCus;
private Long numOfLockCus;
private String campaignTypeName;
private Date timeRangeStartTime;
......@@ -65,4 +64,6 @@ public class CampaignDTO extends BaseDTO {
private List<TimeZoneDialModeDTO> lstTimeZone;
private Short agentStatus;
private String sessionId;
private Long numOfInteractedCus;
private Long numOfNotInteractedCus;
}
......@@ -108,7 +108,7 @@ public class CampaignCompleteCodeController {
@GetMapping("/getListStatusWithoutType")
@ResponseBody
public ResponseEntity<ResultDTO> getListStatusWithoutType(@RequestParam("completeValue") String completeValue, @RequestParam("completeType") Short completeType, @RequestParam("companySiteId") Long companySiteId) {
ResultDTO result = completeCodeService.getListStatusWithoutType(completeValue, completeType, companySiteId);
ResultDTO result = completeCodeService.getListStatusWithoutValue(completeValue, completeType, companySiteId);
return new ResponseEntity(result, HttpStatus.OK);
}
......
......@@ -121,4 +121,36 @@ public class CampaignController {
public ResultDTO checkAllowStatusToPrepare(@RequestParam("campaignId") Long campaignId) {
return campaignService.checkAllowStatusToPrepare(campaignId);
}
@RequestMapping(value = "/exportCampaigns", method = RequestMethod.POST)
@ResponseBody
public ResponseEntity<?> exportCampaigns(HttpServletResponse response, @RequestBody CampaignRequestDTO dto) {
XSSFWorkbook workbook = null;
byte[] contentReturn = null;
try {
String fileName = "report_campaigns.xlsx";
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
OutputStream outputStream;
workbook = campaignService.exportCampaigns(dto);
outputStream = response.getOutputStream();
workbook.write(outputStream);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
workbook.write(byteArrayOutputStream);
contentReturn = byteArrayOutputStream.toByteArray();
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
return new ResponseEntity<byte[]>(null, null, HttpStatus.BAD_REQUEST);
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}
}
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.parseMediaType("application/vnd.ms-excel"));
return new ResponseEntity<byte[]>(contentReturn, headers, HttpStatus.OK);
}
}
......@@ -179,7 +179,7 @@ public class CustomerController {
return new ResponseEntity(result, HttpStatus.OK);
}
@GetMapping("/getCustomerRecall")
@PostMapping("/getCustomerRecall")
@ResponseBody
public ResponseEntity<ResultDTO> getCustomerRecall(@RequestParam("campaignId") Long campaignId, @RequestParam("customerId") Long customerId) {
ResultDTO result = customerService.getCustomerRecall(campaignId, customerId);
......
......@@ -14,3 +14,28 @@ campaign.execute.interactive.contactStatus = Contact status
campaign.execute.interactive.surveyStatus = Trạng thái khảo sát
campaign.execute.interactive.status = Trạng thái chiến dịch
campaign.execute.interactive.recordStatus = Trạng thái bản ghi
#Campaign
campaign = Campaigns
campaign.code = Campaign tode
campaign.name = Campaign tame
campaign.type = Campaign type
campaign.chanel = Chanel
campaign.startTime = Start time
campaign.endTime = End time
campaign.cusNum = Number of customers
campaign.joinedCusNum = Number of joined customers
campaign.interactedCusNum = Number of customers interacted
campaign.notInteractedCusNum = Number of customers not interacted
campaign.logCusNum = Number of locked customers
campaign.status = Status
campaign.chanel.1 = Voice chanel
campaign.chanel.2 = SMS chanel
campaign.chanel.3 = Email chanel
campaign.chanel.4 = IVR chanel
campaign.status.0 = Draft
campaign.status.1 = Prepare
campaign.status.2 = Deploy
campaign.status.3 = Pause
campaign.status.4 = Finish
campaign.status.5 = Kêt thúc sớm
......@@ -14,3 +14,32 @@ campaign.execute.interactive.contactStatus = Trạng thái kết nối
campaign.execute.interactive.surveyStatus = Trạng thái khảo sát
campaign.execute.interactive.status = Trạng thái chiến dịch
campaign.execute.interactive.recordStatus = Trạng thái bản ghi
#Campaigns
campaign = Danh sách chiến dịch
campaign.title = DANH SÁCH CHIẾN DỊCH
campaign.code = Mã chiến dịch
campaign.name = Tên chiến dịch
campaign.type = Loại chiến dịch
campaign.chanel = Kênh
campaign.startTime = Thời gian bắt đầu
campaign.endTime = Thời gian kết thúc
campaign.cusNum = Số lượng khách hàng
campaign.joinedCusNum = Số lượng khách hàng tham gia
campaign.interactedCusNum = Số lượng khách hàng đã tương tác
campaign.notInteractedCusNum = Số lượng khách hàng chưa tương tác
campaign.logCusNum = Số lượng khách hàng DNC/Khoá
campaign.status = Trạng thái
campaign.chanel.1 = Kênh Voice
campaign.chanel.2 = Kênh SMS
campaign.chanel.3 = Kênh Email
campaign.chanel.4 = Kênh IVR
campaign.status.0 = Dự thảo
campaign.status.1 = Chuẩn bị
campaign.status.2 = Triển khai
campaign.status.3 = Tạm ngừng
campaign.status.4 = Kêt thúc
campaign.status.5 = Kêt thúc sớm
......@@ -11,7 +11,8 @@ SELECT
a.STATUS status,
a.CUSTOMER_NUMBER cusNum,
b.SLKHThamgiaCD numOfJoinedCus,
c.SLKHChuaTuongTac numOfNotJoinedCus,
e.SLKHDaTuongTac numOfInteractedCus,
c.SLKHChuaTuongTac numOfNotInteractedCus,
d.SLKHDoNotCall_Khoa numOfLockCus,
a.COMPANY_SITE_ID companySiteId,
a.CONTENT content,
......@@ -29,7 +30,7 @@ LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHThamgiaCD
ON a.CAMPAIGN_ID = b.CAMPAIGN_ID
LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHChuaTuongTac
FROM campaign_customer cc INNER JOIN CUSTOMER cus ON cc.CUSTOMER_ID = cus.CUSTOMER_ID
WHERE 1 = 1 AND cc.STATUS <> 0 AND cus.STATUS = 1
WHERE 1 = 1 AND cc.STATUS = 0 AND cus.STATUS = 1
group by campaign_id) c
ON c.CAMPAIGN_ID = a.CAMPAIGN_ID
LEFT JOIN (SELECT cc.campaign_id, count(*) AS SLKHDoNotCall_Khoa
......@@ -38,6 +39,11 @@ LEFT JOIN (SELECT cc.campaign_id, count(*) AS SLKHDoNotCall_Khoa
AND (c.IPCC_STATUS = 'locked' or c.CALL_ALLOWED = 0) AND cc.STATUS = 1
GROUP BY cc.CAMPAIGN_ID) d
ON d.CAMPAIGN_ID = a.CAMPAIGN_ID
LEFT JOIN (SELECT campaign_id, COUNT (*) AS SLKHDaTuongTac
FROM campaign_customer cc INNER JOIN CUSTOMER cus ON cc.CUSTOMER_ID = cus.CUSTOMER_ID
WHERE 1 = 1 AND cc.STATUS <> 0 AND cus.STATUS = 1
group by campaign_id) e
ON e.CAMPAIGN_ID = a.CAMPAIGN_ID
WHERE 1 = 1
AND COMPANY_SITE_ID = :p_company_site_id
AND a.STATUS <> -1
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