Commit 77d9a47f authored by Phạm Duy Phi's avatar Phạm Duy Phi

phipd commit

parent b1ee87e2
...@@ -192,8 +192,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -192,8 +192,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_customer_id", "%" + query.setParameter("p_customer_id", "%" +
dto.getCustomerId().toUpperCase() dto.getCustomerId().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\\\_") .replaceAll("_", "\\_")
+ "%"); + "%");
} }
...@@ -226,8 +226,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -226,8 +226,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_phone_number", "%" + query.setParameter("p_phone_number", "%" +
dto.getPhoneNumber().toUpperCase() dto.getPhoneNumber().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\\\_") .replaceAll("_", "\\_")
+ "%"); + "%");
} }
...@@ -235,8 +235,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -235,8 +235,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_campaign_name", "%" + query.setParameter("p_campaign_name", "%" +
dto.getCampaignName().toUpperCase() dto.getCampaignName().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\\\_") .replaceAll("_", "\\_")
+ "%"); + "%");
} }
...@@ -244,8 +244,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -244,8 +244,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_user_name", "%" + query.setParameter("p_user_name", "%" +
dto.getAgentId().toUpperCase() dto.getAgentId().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\\\_") .replaceAll("_", "\\_")
+ "%"); + "%");
} }
......
...@@ -32,8 +32,6 @@ public interface CustomerService { ...@@ -32,8 +32,6 @@ public interface CustomerService {
// ------------ customer list ------------ // // ------------ customer list ------------ //
ResultDTO getAllCustomerList(int page, int pageSize, String sort, Long companySiteId);
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI // THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY // VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName); ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName);
......
...@@ -143,109 +143,101 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -143,109 +143,101 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Transactional(DataSourceQualify.CCMS_FULL) @Transactional(DataSourceQualify.CCMS_FULL)
public XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException { public XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException {
Locale locale = Locale.forLanguageTag("vi"); Locale locale = Locale.forLanguageTag("vi");
List<ContactCustResultDTO> list = campaignExecuteRepository.getExcelInteractiveResult(dto); List<ContactCustResultDTO> list = campaignExecuteRepository.getInteractiveResult(dto, null);
XSSFWorkbook workbook = null; XSSFWorkbook workbook = new XSSFWorkbook();
Sheet sheet; Sheet sheet;
try { // create font style
// create font style Font defaultFont = workbook.createFont();
workbook = new XSSFWorkbook(); defaultFont.setFontHeightInPoints((short) 13);
Font defaultFont = workbook.createFont(); defaultFont.setFontName("Times New Roman");
defaultFont.setFontHeightInPoints((short) 13); defaultFont.setColor(IndexedColors.BLACK.getIndex());
defaultFont.setFontName("Times New Roman");
defaultFont.setColor(IndexedColors.BLACK.getIndex()); Font titleFont = workbook.createFont();
titleFont.setFontHeightInPoints((short) 18);
Font titleFont = workbook.createFont(); titleFont.setFontName("Times New Roman");
titleFont.setFontHeightInPoints((short) 18); titleFont.setColor(IndexedColors.BLACK.getIndex());
titleFont.setFontName("Times New Roman"); titleFont.setBold(true);
titleFont.setColor(IndexedColors.BLACK.getIndex());
titleFont.setBold(true); Font headerFont = workbook.createFont();
headerFont.setFontHeightInPoints((short) 13);
Font headerFont = workbook.createFont(); headerFont.setFontName("Times New Roman");
headerFont.setFontHeightInPoints((short) 13); headerFont.setColor(IndexedColors.BLACK.getIndex());
headerFont.setFontName("Times New Roman"); headerFont.setBold(true);
headerFont.setColor(IndexedColors.BLACK.getIndex());
headerFont.setBold(true); CellStyle styleTitle = workbook.createCellStyle();
styleTitle.setFont(titleFont);
CellStyle styleTitle = workbook.createCellStyle(); styleTitle.setAlignment(HorizontalAlignment.CENTER);
styleTitle.setFont(titleFont);
styleTitle.setAlignment(HorizontalAlignment.CENTER); CellStyle styleRowHeader = workbook.createCellStyle();
styleRowHeader.setFont(headerFont);
CellStyle styleRowHeader = workbook.createCellStyle(); styleRowHeader.setAlignment(HorizontalAlignment.CENTER);
styleRowHeader.setFont(headerFont); styleRowHeader.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());
styleRowHeader.setAlignment(HorizontalAlignment.CENTER); styleRowHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND);
styleRowHeader.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex()); styleRowHeader.setBorderRight(BorderStyle.THIN);
styleRowHeader.setFillPattern(FillPatternType.SOLID_FOREGROUND); styleRowHeader.setRightBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderRight(BorderStyle.THIN); styleRowHeader.setBorderBottom(BorderStyle.THIN);
styleRowHeader.setRightBorderColor(IndexedColors.BLACK.getIndex()); styleRowHeader.setBottomBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderBottom(BorderStyle.THIN); styleRowHeader.setBorderLeft(BorderStyle.THIN);
styleRowHeader.setBottomBorderColor(IndexedColors.BLACK.getIndex()); styleRowHeader.setLeftBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderLeft(BorderStyle.THIN); styleRowHeader.setBorderTop(BorderStyle.THIN);
styleRowHeader.setLeftBorderColor(IndexedColors.BLACK.getIndex()); styleRowHeader.setTopBorderColor(IndexedColors.BLACK.getIndex());
styleRowHeader.setBorderTop(BorderStyle.THIN);
styleRowHeader.setTopBorderColor(IndexedColors.BLACK.getIndex()); CellStyle styleRow = workbook.createCellStyle();
styleRow.setFont(defaultFont);
CellStyle styleRow = workbook.createCellStyle();
styleRow.setFont(defaultFont); // list header
List<String> headerList = new ArrayList<>();
// list header headerList.add(BundleUtils.getLangString("stt", locale));
List<String> headerList = new ArrayList<>(); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.campaignCode", locale));
headerList.add(BundleUtils.getLangString("stt", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.campaignName", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.campaignCode", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.agentId", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.campaignName", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.phoneNumber", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.agentId", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.customerName", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.phoneNumber", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.createTime", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.customerId", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.contactStatus", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.customerName", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.surveyStatus", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.createTime", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.status", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.contactStatus", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.recordStatus", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.surveyStatus", locale)); headerList.add(BundleUtils.getLangString("campaign.execute.interactive.callTime", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.status", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.recordStatus", locale)); //
String sheetName = BundleUtils.getLangString("detail", locale);
// sheet = workbook.createSheet(sheetName);
String sheetName = BundleUtils.getLangString("detail", locale);
sheet = workbook.createSheet(sheetName); // Title
String title = BundleUtils.getLangString("campaign.execute.interactive.title", locale);
// Title int rowTitleStart = 3;
String title = BundleUtils.getLangString("campaign.execute.interactive.title", locale); Row rowTitle = sheet.createRow(rowTitleStart);
int rowTitleStart = 3; rowTitle.setHeight((short) 800);
Row rowTitle = sheet.createRow(rowTitleStart); writeCellContent(rowTitle, styleTitle, 3, title);
rowTitle.setHeight((short) 800); sheet.addMergedRegion(new CellRangeAddress(rowTitleStart, rowTitleStart, 3, 8));
writeCellContent(rowTitle, styleTitle, 3, title); // Header
sheet.addMergedRegion(new CellRangeAddress(rowTitleStart, rowTitleStart, 3, 8)); int startRowTable = 5;
// Header int count = 1;
int startRowTable = 5; Row rowHeader = sheet.createRow(startRowTable);
int count = 1; for (int i = 0; i < headerList.size(); i++) {
Row rowHeader = sheet.createRow(startRowTable); writeCellContent(rowHeader, styleRowHeader, i, headerList.get(i));
for (int i = 0; i < headerList.size(); i++) { }
writeCellContent(rowHeader, styleRowHeader, i, headerList.get(i)); // Content
} for (int i = 0, rowIndex = 1; i < list.size(); i++) {
// Content Row row = sheet.createRow(startRowTable + count);
for (int i = 0, rowIndex = 1; i < list.size(); i++) { int col = 0;
Row row = sheet.createRow(startRowTable + count); writeCellContent(row, styleRow, col++, rowIndex);
int col = 0; writeCellContent(row, styleRow, col++, list.get(i).getCampaignCode());
writeCellContent(row, styleRow, col++, rowIndex); writeCellContent(row, styleRow, col++, list.get(i).getCampaignName());
writeCellContent(row, styleRow, col++, list.get(i).getCampaignCode()); writeCellContent(row, styleRow, col++, list.get(i).getUserName());
writeCellContent(row, styleRow, col++, list.get(i).getCampaignName()); writeCellContent(row, styleRow, col++, list.get(i).getPhoneNumber());
writeCellContent(row, styleRow, col++, list.get(i).getUserName()); writeCellContent(row, styleRow, col++, list.get(i).getCustomerName());
writeCellContent(row, styleRow, col++, list.get(i).getPhoneNumber()); writeCellContent(row, styleRow, col++, formatter.format(list.get(i).getCreateTime()));
writeCellContent(row, styleRow, col++, list.get(i).getCustomerName()); writeCellContent(row, styleRow, col++, list.get(i).getConnectStatus());
writeCellContent(row, styleRow, col++, list.get(i).getCustomerName()); writeCellContent(row, styleRow, col++, list.get(i).getSurveyStatus());
writeCellContent(row, styleRow, col++, formatter.format(list.get(i).getCreateTime())); writeCellContent(row, styleRow, col++, list.get(i).getStatus());
writeCellContent(row, styleRow, col++, list.get(i).getContactStatus()); writeCellContent(row, styleRow, col++, list.get(i).getRecordStatus());
writeCellContent(row, styleRow, col++, list.get(i).getSurveyStatus()); writeCellContent(row, styleRow, col++, list.get(i).getCallTime());
writeCellContent(row, styleRow, col++, list.get(i).getStatus()); ++rowIndex;
writeCellContent(row, styleRow, col++, list.get(i).getRecordStatus()); ++count;
++rowIndex;
++count;
}
} catch (Exception e) {
} finally {
if (workbook != null) workbook.close();
} }
return workbook; return workbook;
} }
...@@ -347,7 +339,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -347,7 +339,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
try { try {
if (requestDto.getType() == 2) { if (requestDto.getType() == 2) {
List<CampaignAgent> ca = campaignAgentRepository.findByAgentId(Long.parseLong(requestDto.getAgentId())); List<CampaignAgent> ca = campaignAgentRepository.findByAgentId(Long.parseLong(requestDto.getAgentId()));
for (CampaignAgent item: ca) { for (CampaignAgent item : ca) {
item.setStatus(0); item.setStatus(0);
} }
ca = campaignAgentRepository.saveAll(ca); ca = campaignAgentRepository.saveAll(ca);
......
...@@ -536,92 +536,6 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -536,92 +536,6 @@ public class CustomerServiceImpl implements CustomerService {
} }
// ------------- customer list ----------------- // // ------------- customer list ----------------- //
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getAllCustomerList(int page, int pageSize, String sort, Long companySiteId) {
ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = null;
if (DataUtil.isNullOrZero(companySiteId)) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
return resultDTO;
}
try {
session = sessionFactory.openSession();
session.beginTransaction();
// StringBuilder sb = new StringBuilder();
// sb.append(SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "search-campaign-customer-by-params"));
StringBuilder sb = new StringBuilder();
sb.append("SELECT");
sb.append(" CUSTOMER_LIST_ID customerListId,");
sb.append(" COMPANY_SITE_ID companySiteId,");
sb.append(" CUSTOMER_LIST_CODE customerListCode,");
sb.append(" CUSTOMER_LIST_NAME customerListName,");
sb.append(" STATUS status,");
sb.append(" CREATE_BY createBy,");
sb.append(" CREATE_AT createAt,");
sb.append(" UPDATE_BY updateBy,");
sb.append(" UPDATE_AT updateAt,");
sb.append(" SOURCE source,");
sb.append(" DEPT_CREATE deptCreate");
sb.append(" FROM CUSTOMER_LIST");
sb.append(" WHERE 1 = 1");
sb.append(" AND STATUS = 1");
sb.append(" AND COMPANY_SITE_ID = :p_company_site_id");
sb.append(" ORDER BY CREATE_AT DESC");
SQLQuery query = session.createSQLQuery(sb.toString());
query.setParameter("p_company_site_id", companySiteId);
query.addScalar("customerListId", new LongType());
query.addScalar("companySiteId", new LongType());
query.addScalar("customerListCode", new StringType());
query.addScalar("customerListName", new StringType());
query.addScalar("status", new ShortType());
query.addScalar("createBy", new StringType());
query.addScalar("createAt", new DateType());
query.addScalar("updateBy", new StringType());
query.addScalar("updateAt", new DateType());
query.addScalar("source", new StringType());
query.addScalar("deptCreate", new StringType());
query.setResultTransformer(Transformers.aliasToBean(CustomerListDTO.class));
int count = 0;
List<CustomerListDTO> dtoList = query.list();
if (dtoList.size() > 0) {
count = query.list().size();
}
Pageable pageable = PageRequest.of(page, pageSize, Sort.by(Sort.Order.desc(sort)));
if (pageable != null) {
query.setFirstResult(pageable.getPageNumber() * pageable.getPageSize());
query.setMaxResults(pageable.getPageSize());
}
List<CustomerListDTO> data = query.list();
Page<CustomerListDTO> dataPage = new PageImpl<>(data, pageable, count);
resultDTO.setData(dataPage);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} finally {
if (session != null) session.close();
}
return resultDTO;
}
@Override @Override
@Transactional(DataSourceQualify.CCMS_FULL) @Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName) { public ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName) {
......
...@@ -24,7 +24,7 @@ import java.util.List; ...@@ -24,7 +24,7 @@ import java.util.List;
@RestController @RestController
@RequestMapping("/ipcc/campaign/execute") @RequestMapping("/ipcc/campaign/execute")
//@CrossOrigin @CrossOrigin(origins = "*")
public class CampaignExecuteController { public class CampaignExecuteController {
private static final Logger logger = LoggerFactory.getLogger(CampaignController.class); private static final Logger logger = LoggerFactory.getLogger(CampaignController.class);
......
...@@ -98,14 +98,6 @@ public class CustomerController { ...@@ -98,14 +98,6 @@ public class CustomerController {
// --------------- customer list table ----------------- // // --------------- customer list table ----------------- //
@GetMapping("/findAlls")
@ResponseBody
public ResponseEntity findAllCustomerList(@RequestParam("page") int page, @RequestParam("pageSize") int pageSize, @RequestParam("sort") String sort, @RequestParam("companySiteId") Long companySiteId) {
ResultDTO result = customerService.getAllCustomerList(page, pageSize, sort, companySiteId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/createCustomerList") @PostMapping("/createCustomerList")
@ResponseBody @ResponseBody
public ResultDTO createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) { public ResultDTO createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) {
......
...@@ -14,6 +14,7 @@ campaign.execute.interactive.contactStatus = Contact status ...@@ -14,6 +14,7 @@ campaign.execute.interactive.contactStatus = Contact status
campaign.execute.interactive.surveyStatus = Trạng thái khảo sát 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.status = Trạng thái chiến dịch
campaign.execute.interactive.recordStatus = Trạng thái bản ghi campaign.execute.interactive.recordStatus = Trạng thái bản ghi
campaign.execute.interactive.callTime = Thời lượng cuộc gọi
#Campaign #Campaign
campaign = Campaigns campaign = Campaigns
......
...@@ -14,6 +14,7 @@ campaign.execute.interactive.contactStatus = Trạng thái kết nối ...@@ -14,6 +14,7 @@ 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.surveyStatus = Trạng thái khảo sát
campaign.execute.interactive.status = Trạng thái chiến dịch campaign.execute.interactive.status = Trạng thái chiến dịch
campaign.execute.interactive.recordStatus = Trạng thái bản ghi campaign.execute.interactive.recordStatus = Trạng thái bản ghi
campaign.execute.interactive.callTime = Thời lượng cuộc gọi
#Campaigns #Campaigns
......
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