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 {
query.setParameter("p_customer_id", "%" +
dto.getCustomerId().toUpperCase()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
......@@ -226,8 +226,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_phone_number", "%" +
dto.getPhoneNumber().toUpperCase()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
......@@ -235,8 +235,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_campaign_name", "%" +
dto.getCampaignName().toUpperCase()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
......@@ -244,8 +244,8 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setParameter("p_user_name", "%" +
dto.getAgentId().toUpperCase()
.replace("\\", "\\\\")
.replaceAll("%", "\\\\%")
.replaceAll("_", "\\\\_")
.replaceAll("%", "\\%")
.replaceAll("_", "\\_")
+ "%");
}
......
......@@ -32,8 +32,6 @@ public interface CustomerService {
// ------------ 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
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName);
......
......@@ -143,13 +143,11 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Transactional(DataSourceQualify.CCMS_FULL)
public XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException {
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;
try {
// create font style
workbook = new XSSFWorkbook();
Font defaultFont = workbook.createFont();
defaultFont.setFontHeightInPoints((short) 13);
defaultFont.setFontName("Times New Roman");
......@@ -195,13 +193,13 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.campaignName", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.agentId", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.phoneNumber", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.customerId", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.customerName", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.createTime", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.contactStatus", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.surveyStatus", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.status", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.recordStatus", locale));
headerList.add(BundleUtils.getLangString("campaign.execute.interactive.callTime", locale));
//
String sheetName = BundleUtils.getLangString("detail", locale);
......@@ -231,21 +229,15 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
writeCellContent(row, styleRow, col++, list.get(i).getUserName());
writeCellContent(row, styleRow, col++, list.get(i).getPhoneNumber());
writeCellContent(row, styleRow, col++, list.get(i).getCustomerName());
writeCellContent(row, styleRow, col++, list.get(i).getCustomerName());
writeCellContent(row, styleRow, col++, formatter.format(list.get(i).getCreateTime()));
writeCellContent(row, styleRow, col++, list.get(i).getContactStatus());
writeCellContent(row, styleRow, col++, list.get(i).getConnectStatus());
writeCellContent(row, styleRow, col++, list.get(i).getSurveyStatus());
writeCellContent(row, styleRow, col++, list.get(i).getStatus());
writeCellContent(row, styleRow, col++, list.get(i).getRecordStatus());
writeCellContent(row, styleRow, col++, list.get(i).getCallTime());
++rowIndex;
++count;
}
} catch (Exception e) {
} finally {
if (workbook != null) workbook.close();
}
return workbook;
}
......@@ -347,7 +339,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
try {
if (requestDto.getType() == 2) {
List<CampaignAgent> ca = campaignAgentRepository.findByAgentId(Long.parseLong(requestDto.getAgentId()));
for (CampaignAgent item: ca) {
for (CampaignAgent item : ca) {
item.setStatus(0);
}
ca = campaignAgentRepository.saveAll(ca);
......
......@@ -536,92 +536,6 @@ public class CustomerServiceImpl implements CustomerService {
}
// ------------- 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
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName) {
......
......@@ -24,7 +24,7 @@ import java.util.List;
@RestController
@RequestMapping("/ipcc/campaign/execute")
//@CrossOrigin
@CrossOrigin(origins = "*")
public class CampaignExecuteController {
private static final Logger logger = LoggerFactory.getLogger(CampaignController.class);
......
......@@ -98,14 +98,6 @@ public class CustomerController {
// --------------- 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")
@ResponseBody
public ResultDTO createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) {
......
......@@ -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.status = Trạng thái chiến dịch
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 = Campaigns
......
......@@ -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.status = Trạng thái chiến dịch
campaign.execute.interactive.recordStatus = Trạng thái bản ghi
campaign.execute.interactive.callTime = Thời lượng cuộc gọi
#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