Commit 007fb923 authored by Tu Bach's avatar Tu Bach

Merge branch 'master' into tubn

parents 5fafc0cb 8525dae2
......@@ -243,16 +243,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
}
List<CampaignDTO> data = query.list();
data.forEach(item -> {
item.setStartTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getStartTime(),tzClient)));
item.setEndTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getEndTime(),tzClient)));
if(item.getStartTime() != null) item.setStartTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getStartTime(),tzClient)));
if(item.getEndTime() != null) item.setEndTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getEndTime(),tzClient)));
});
Page<CampaignDTO> dataPage = new PageImpl<>(data, pageable, count);
result.setData(dataPage);
} else {
List<CampaignDTO> dataExport = query.list();
dataExport.forEach(item -> {
item.setStartTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getStartTime(),tzClient)));
item.setEndTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getEndTime(),tzClient)));
if(item.getStartTime() != null) item.setStartTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getStartTime(),tzClient)));
if(item.getEndTime() != null) item.setEndTime(DateTimeUtil.parseDate("dd/MM/yyyy HH:mm:ss",TimeZoneUtils.toDateStringWithTimeZone(item.getEndTime(),tzClient)));
});
result.setData(dataExport);
}
......@@ -551,6 +551,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb.append(" select title columnName, customize_field_id customizeFieldId, 0 isFix from customize_fields, dual");
sb.append(" where function_code = 'CUSTOMER'");
sb.append(" and site_id = :p_company_site_id");
sb.append(" and status = 1");
sb.append(" and active = 1");
sb.append(" and customize_field_id not in (select customize_field_id from campaign_customerlist_column where campaign_customerlist_column.campaign_id = :p_campaign_id)");
params.put("p_company_site_id", dto.getCompanySiteId());
params.put("p_campaign_id", dto.getCampaignId());
......@@ -932,10 +934,15 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb.append(" from campaign_customer");
sb.append(" group by campaign_id");
sb.append(" )");
sb.append(" select a.*, b.customer_number campaignCustomer");
sb.append(" from count_customer a");
sb.append(" left join campaign b on a.campaignId = b.campaign_id");
sb.append(" where a.campaignId = :p_campaign_id");
sb.append(" select b.campaign_id campaignId,");
sb.append(" nvl(a.totalIndividual, 0) totalIndividual,");
sb.append(" nvl(a.totalNotInteractive, 0) totalNotInteractive,");
sb.append(" nvl(a.totalNotCall, 0) totalNotCall,");
sb.append(" nvl(a.totalCusInList, 0) totalCusInList,");
sb.append(" b.customer_number campaignCustomer");
sb.append(" from campaign b");
sb.append(" left join count_customer a on a.campaignId = b.campaign_id");
sb.append(" where b.campaign_id = :p_campaign_id");
params.put("p_campaign_id", dto.getCampaignId());
params.put("p_company_site_id", dto.getCompanySiteId());
list = namedParameterJdbcTemplate.query(sb.toString(), params, BeanPropertyRowMapper.newInstance(CampaignInformationDTO.class));
......
......@@ -4,12 +4,10 @@ import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.*;
import com.viettel.campaign.repository.ccms_full.*;
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.utils.*;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.poi.ss.usermodel.CellStyle;
......@@ -275,6 +273,8 @@ public class CampaignServiceImpl implements CampaignService {
CellStyle styleRowHeader = WorkBookBuilder.buildDefaultStyleRowHeader(workbook);
CellStyle styleRow = WorkBookBuilder.buildDefaultStyleRow(workbook);
styleRowHeader.setWrapText(true);
styleRow.setWrapText(true);
// list header
List<String> fileHeaderList = new ArrayList<>();
fileHeaderList.add(BundleUtils.getLangString("stt", locale));
......@@ -294,12 +294,12 @@ public class CampaignServiceImpl implements CampaignService {
//
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));
......@@ -308,6 +308,7 @@ public class CampaignServiceImpl implements CampaignService {
int count = 1;
Row rowHeader = sheet.createRow(startRowTable);
for (int i = 0; i < fileHeaderList.size(); i++) {
sheet.setColumnWidth(i, 6500);
WorkBookBuilder.writeCellContent(rowHeader, styleRowHeader, i, fileHeaderList.get(i));
}
// Content
......@@ -319,8 +320,8 @@ public class CampaignServiceImpl implements CampaignService {
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++, DateTimeUtil.format("dd/MM/yyyy",listData.get(i).getStartTime(), ""));
WorkBookBuilder.writeCellContent(row, styleRow, col++, DateTimeUtil.format("dd/MM/yyyy",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());
......
......@@ -5,14 +5,11 @@
*/
package com.viettel.campaign.utils;
import org.apache.log4j.Logger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
/**
*
......@@ -86,7 +83,7 @@ public class TimeZoneUtils {
public static String toDateStringWithTimeZone(Date date, TimeZone tz){
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
sdf.setTimeZone(tz);
return sdf.format(date);
return date == null ? null : sdf.format(date);
}
public static TimeZone getZone(Long timeZone){
......
......@@ -102,7 +102,7 @@ customer.importCustomer = IMPORT CUSTOMER
customer.notice = Attention: A record is valid when Full Name is not null and one of three fields Main phone, secondary phone or email is not null
customer.emailInvalid=Invalid email;
customer.emailExists=Email exists;
customer.cusTypeInvalid=Customer type Invalid;
customer.comboboxInvalid=Combobox option invalid;
common.fileNotSelected=Please select a file
common.fileInvalidFormat=File invalid
......
......@@ -104,7 +104,7 @@ customer.importCustomer = IMPORT KHÁCH HÀNG
customer.notice = Chú ý: 1 bản ghi được coi là hợp lệ bắt buộc phải có thông tin Họ và Tên và 1 trong 3 thông tin liên lạc (số điện thoại chính, số điện thoại phụ hoặc email)
customer.emailInvalid=Email không đúng định dạng;
customer.emailExists=Email đã tồn tại;
customer.cusTypeInvalid=Loại khách hàng không hợp lệ;
customer.comboboxInvalid=Dữ liệu trong combobox không hợp lệ;
common.fileNotSelected=Bạn chưa chọn file
common.fileInvalidFormat=File không hợp lệ
......
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