Commit ac971245 authored by Phạm Duy Phi's avatar Phạm Duy Phi

phipd commit

parents 3b3b1c1d 63912d12
......@@ -49,8 +49,8 @@
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<!-- <scope>system</scope>-->
<!-- <systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>-->
<scope>system</scope>
<systemPath>${project.basedir}/lib/ojdbc7.jar</systemPath>
<version>1.0</version>
</dependency>
<dependency>
......@@ -121,6 +121,12 @@
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
......
......@@ -31,27 +31,27 @@ public class CorsFilter implements Filter {
HttpServletRequest request = (HttpServletRequest) req;
chain.doFilter(req, resp);
// if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
// chain.doFilter(req, resp);
// return;
// }
// if ("/".equals(request.getRequestURI())) {
// chain.doFilter(req, resp);
// return;
// }
// String xAuthToken = request.getHeader("X-Auth-Token");
// if (xAuthToken == null || "".equals(xAuthToken)) {
// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
// return;
// }
// Object obj = RedisUtil.getInstance().get(xAuthToken);
// if (obj instanceof UserSession) {
// chain.doFilter(req, resp);
// } else {
// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
// }
// chain.doFilter(req, resp);
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
chain.doFilter(req, resp);
return;
}
if ("/".equals(request.getRequestURI())) {
chain.doFilter(req, resp);
return;
}
String xAuthToken = request.getHeader("X-Auth-Token");
if (xAuthToken == null || "".equals(xAuthToken)) {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
return;
}
Object obj = RedisUtil.getInstance().get(xAuthToken);
if (obj instanceof UserSession) {
chain.doFilter(req, resp);
} else {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
}
}
@Override
......
......@@ -21,7 +21,7 @@ public class CustomerMapper extends BaseMapper<Customer, CustomerDTO> {
obj.setMobileNumber(model.getMobileNumber());
obj.setName(model.getName());
obj.setSiteId(model.getSiteId());
obj.setStatus(model.getStatus());
obj.setStatus(model.getStatus().toString());
// String additionalInfo = "";
// if (model.getName() != null && !"".equals(model.getName())) {
// additionalInfo += model.getName();
......@@ -58,7 +58,7 @@ public class CustomerMapper extends BaseMapper<Customer, CustomerDTO> {
obj.setCustomerImg(dtoBean.getCustomerImg());
obj.setCreateDate(dtoBean.getCreateDate());
obj.setUpdateDate(dtoBean.getUpdateDate());
obj.setStatus(dtoBean.getStatus());
obj.setStatus(Long.parseLong(dtoBean.getStatus()));
obj.setCreateBy(dtoBean.getCreateBy());
obj.setUpdateBy(dtoBean.getUpdateBy());
obj.setSiteId(dtoBean.getSiteId());
......@@ -71,7 +71,7 @@ public class CustomerMapper extends BaseMapper<Customer, CustomerDTO> {
obj.setUserName(dtoBean.getUserName());
obj.setAreaCode(dtoBean.getAreaCode());
obj.setCustomerType(dtoBean.getCustomerType());
obj.setCallAllowed(dtoBean.getCallAllowed());
obj.setCallAllowed(Long.parseLong(dtoBean.getCallAllowed()));
obj.setEmailAllowed(dtoBean.getEmailAllowed());
obj.setSmsAllowed(dtoBean.getSmsAllowed());
obj.setIpccStatus(dtoBean.getIpccStatus());
......
......@@ -45,7 +45,7 @@ public class Customer implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
@Column(name = "STATUS")
private String status;
private Long status;
@Size(max = 50)
@Column(name = "CREATE_BY")
private String createBy;
......@@ -80,7 +80,7 @@ public class Customer implements Serializable {
@Column(name = "CUSTOMER_TYPE")
private Long customerType;
@Column(name = "CALL_ALLOWED")
private String callAllowed;
private Long callAllowed;
@Column(name = "EMAIL_ALLOWED")
private Long emailAllowed;
@Column(name = "SMS_ALLOWED")
......@@ -88,4 +88,7 @@ public class Customer implements Serializable {
@Size(max = 100)
@Column(name = "IPCC_STATUS")
private String ipccStatus;
@Size(max = 2000)
@Column(name = "AVATAR_LINK")
private String avatarLink;
}
......@@ -43,4 +43,6 @@ public class CustomerContact {
@Column(name = "END_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date endDate;
@Column(name = "SITE_ID")
private Long siteId;
}
package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
......@@ -13,6 +15,8 @@ import java.util.Date;
@Table(name = "CUSTOMER_LIST")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CustomerList implements Serializable {
@Id
......
package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Entity
@Table(name = "CUSTOMER_LIST_MAPPING")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CustomerListMapping implements Serializable {
@Id
@GeneratedValue(generator = "customer_list_mapping_seq")
@SequenceGenerator(name = "customer_list_mapping_seq", sequenceName = "customer_list_mapping_seq", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "CUSTOMER_LIST_MAPPING_ID")
private Long customerListMappingId;
@NotNull
@Column(name = "CUSTOMER_ID")
private Long customerId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@NotNull
@Column(name = "CUSTOMER_LIST_ID")
private Long customerListId;
}
package com.viettel.campaign.web.dto;
package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "CUSTOMIZE_FIELD_OBJECT")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CustomizeFieldDTO {
public class CustomizeFieldObject implements Serializable {
@Id
@GeneratedValue(generator = "CUSTOMIZE_FIELD_OBJECT_SEQ")
@SequenceGenerator(name = "CUSTOMIZE_FIELD_OBJECT_SEQ", sequenceName = "CUSTOMIZE_FIELD_OBJECT_SEQ", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "CUSTOMIZE_FIELD_OBJECT_ID")
private Long customizeFieldObjectId;
@Column(name = "OBJECT_ID")
private Long objectId;
@Column(name = "CUSTOMIZE_FIELDS_ID")
private Long customizeFieldId;
@Column(name = "VALUE_TEXT")
private String valueText;
@Column(name = "VALUE_NUMBER")
private Long valueNumber;
@Column(name = "VALUE_DATE")
private Date valueDate;
@Column(name = "VALUE_CHECKBOX")
private Long valueCheckbox;
private Date createBy;
@Column(name = "CREATE_BY")
private String createBy;
@Column(name = "CREATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Column(name = "UPDATE_BY")
private String updateBy;
@Column(name = "UPDATE_DATE")
private Date updateDate;
@Column(name = "STATUS")
private Long status;
@Column(name = "FIELD_OPTION_VALUE_ID")
private Long fieldOptionValueId;
@Column(name = "TITLE")
private String title;
@Column(name = "FUNCTION_CODE")
private String functionCode;
}
package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "CUSTOMIZE_FIELD_OPTION_VALUE")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class CustomizeFieldOptionValue implements Serializable {
@Id
@Column(name = "FIELD_OPTION_VALUE_ID")
@Basic(optional = false)
@NotNull
private Long fieldOptionValueId;
@Column(name = "FIELD_OPTION_ID")
private Long fieldOptionId;
@Column(name = "NAME")
private String name;
@Column(name = "VALUE")
private String value;
@Column(name = "POSITION")
private Long position;
@Column(name = "CREATE_BY")
private String createBy;
@Column(name = "CREATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Column(name = "UPDATE_BY")
private String updateBy;
@Column(name = "UPDATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
@Column(name = "STATUS")
private Long status;
}
package com.viettel.campaign.web.dto;
package com.viettel.campaign.model.ccms_full;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "CUSTOMIZE_FIELDS")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class DynamicExcelHeaderDTO {
public class CustomizeFields implements Serializable {
@Id
@GeneratedValue(generator = "CUSTOMIZE_FIELDS_SEQ")
@SequenceGenerator(name = "CUSTOMIZE_FIELDS_SEQ", sequenceName = "CUSTOMIZE_FIELDS_SEQ", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "CUSTOMIZE_FIELD_ID")
private Long customizeFieldId;
@Column(name = "SITE_ID")
private Long siteId;
@Column(name = "FUNCTION_CODE")
private String functionCode;
@Column(name = "CREATE_BY")
private String createBy;
@Column(name = "CREATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date createDate;
@Column(name = "UPDATE_BY")
private String updateBy;
@Column(name = "UPDATE_DATE")
@Temporal(TemporalType.TIMESTAMP)
private Date updateDate;
@Column(name = "STATUS")
private Long status;
@Column(name = "TYPE")
private String type;
@Column(name = "TITLE")
private String title;
@Column(name = "PLACEHOLDER")
private String placeholder;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "POSITION")
private Long position;
@Column(name = "REQUIRED")
private Long required;
@Column(name = "FIELD_OPTIONS_ID")
private Long fieldOptionsId;
@Column(name = "REGEXP_FOR_VALIDATION")
private String regexpForValidation;
@Column(name = "MAX_LENGTH")
private Long maxLength;
@Column(name = "MIN_LENGTH")
private Long minLength;
@Column(name = "MIN")
private Long min;
@Column(name = "MAX")
private Long max;
@Column(name = "ACTIVE")
private Long active;
public CustomizeFields(String type, String title) {
this.type = type;
this.title = title;
}
}
......@@ -26,4 +26,6 @@ public interface CampaignRepositoryCustom {
ResultDTO getListFieldsNotShow(CampaignRequestDTO dto);
//hungtt
ResultDTO getListFieldsToShow(CampaignRequestDTO dto);
//hungtt
ResultDTO getCampaignCustomerList(CampaignRequestDTO dto);
}
......@@ -11,4 +11,6 @@ import java.util.List;
public interface CustomerContactRepository extends JpaRepository<CustomerContact, Long> {
@Query("FROM CustomerContact WHERE status = 1 AND customerId = :customerId AND contactType = :contactType AND (contact IS NULL OR UPPER(contact) LIKE UPPER(concat('%', :contact, '%')))")
List<CustomerContact> findByCustomerIdAndAndContactTypeAndContact(@Param("customerId") Long customerId, @Param("contactType") Short contactType, @Param("contact") String contact, Pageable pageable);
CustomerContact findCustomerContactByContactTypeAndContactAndIsDirectLine(Short contactType, String contact, Short isDirectLine);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomizeFieldObject;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CustomizeFieldObjectRepository extends JpaRepository<CustomizeFieldObject, Long> {
List<CustomizeFieldObject> findCustomizeFieldObjectsByFunctionCodeEqualsAndObjectId(String str, Long id);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomizeFieldOptionValue;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CustomizeFieldOptionValueRepository extends JpaRepository<CustomizeFieldOptionValue, Long> {
List<CustomizeFieldOptionValue> findCustomizeFieldOptionValuesByFieldOptionIdAndStatus(Long id, Long status);
CustomizeFieldOptionValue findCustomizeFieldOptionValueByNameEqualsAndStatus(String name, Long status);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.CustomizeFields;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface CustomizeFieldsRepository extends JpaRepository<CustomizeFields, Long> {
List<CustomizeFields> findCustomizeFieldsByFunctionCodeEqualsAndStatusAndActiveAndSiteId(String functionCode, Long status, Long active, Long siteId);
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
/**
* @author anhvd_itsol
*/
......
......@@ -20,4 +20,6 @@ public interface TimeRangeDialModeRepository extends JpaRepository<TimeRangeDial
@Query(value = "SELECT * FROM TIME_RANGE_DIAL_MODE r " +
"WHERE r.CAMPAIGN_ID = :campaignId AND r.COMPANY_SITE_ID = :companySiteId AND TO_CHAR(r.START_TIME,'HH24:MI:SS') <= TO_CHAR(SYSDATE,'HH24:MI:SS')", nativeQuery = true)
TimeRangeDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
......@@ -20,4 +20,6 @@ public interface TimeZoneDialModeRepository extends JpaRepository<TimeZoneDialMo
@Query(value = "SELECT * FROM TIME_ZONE_DIAL_MODE z " +
"WHERE z.CAMPAIGN_ID = :campaignId AND z.COMPANY_SITE_ID = :companySiteId AND concat(z.HOUR, ':', z.MINUTE) <= TO_CHAR(SYSDATE,'HH24:MI')", nativeQuery = true)
TimeZoneDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
......@@ -8,10 +8,7 @@ import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.utils.HibernateUtil;
import com.viettel.campaign.utils.SQLBuilder;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.CustomerCustomDTO;
import com.viettel.campaign.web.dto.FieldsToShowDTO;
import com.viettel.campaign.web.dto.ResultDTO;
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;
......@@ -571,4 +568,27 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return resultDTO;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCampaignCustomerList(CampaignRequestDTO dto) {
List<CustomerListDTO> list = new ArrayList();
ResultDTO resultDTO = new ResultDTO();
Map<String, String> params = new HashMap<>();
// StringBuilder sb = new StringBuilder();
try {
String sql = SQLBuilder.getSqlQueryById(SQLBuilder.SQL_MODULE_CAMPAIGN_MNG, "get-list-campaign-customer");
params.put("p_campaign_id", dto.getCampaignId());
list = namedParameterJdbcTemplate.query(sql, params, BeanPropertyRowMapper.newInstance(CustomerListDTO.class));
resultDTO.setListData(list);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) {
logger.error(e.getMessage(), e);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
}
package com.viettel.campaign.repository.ccms_full.impl;
import com.viettel.campaign.repository.ccms_full.ScenarioAnswerRepositoryCustom;
import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
/**
* @author anhvd_itsol
*/
public class ScenarioAnswerRepositoryImpl {
public class ScenarioAnswerRepositoryImpl implements ScenarioAnswerRepositoryCustom {
}
......@@ -32,7 +32,6 @@ public class ScenarioQuestionRepositoryImpl implements ScenarioQuestionRepositor
try {
StringBuilder sb = new StringBuilder();
//SELECT COUNT(1) FROM ScenarioQuestion WHERE code = :code AND scenarioId = :scenarioId AND campaignId = :campaignId AND companySiteId = :companySiteId AND status = 1"
sb.append("SELECT COUNT(1) FROM SCENARIO_QUESTION WHERE 1 = 1 AND STATUS = 1 ");
if (questionDTO.getScenarioQuestionId() != null) {
sb.append(" AND SCENARIO_QUESTION_ID <> :p_question_id ");
......
......@@ -54,6 +54,8 @@ public interface CampaignService {
ResultDTO getListFieldsNotShow(CampaignRequestDTO dto);
ResultDTO getListFieldsToShow(CampaignRequestDTO dto);
ResultDTO getCampaignCustomerList(CampaignRequestDTO dto);
//</editor-fold>
}
......@@ -2,15 +2,16 @@ package com.viettel.campaign.service;
import com.viettel.campaign.model.ccms_full.Customer;
import com.viettel.campaign.model.ccms_full.CustomerList;
import com.viettel.campaign.model.ccms_full.CustomizeFieldObject;
import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.econtact.filter.UserSession;
import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
public interface CustomerService {
......@@ -62,9 +63,11 @@ public interface CustomerService {
List<Customer> findAllByCondition(Long siteId, Date endTime);
Customer update(Customer c);
List<DynamicExcelHeaderDTO> getDynamicHeader(Long companySiteId);
List<CustomizeFields> getDynamicHeader(Long companySiteId);
byte[] buildTemplate(Long companySiteId);
void buildTemplate(Long companySiteId);
Map<String, Object> readAndValidateCustomer(String path, List<CustomizeFields> headerDTOS, UserSession userSession, Long customerListId);
List<CustomizeFieldDTO> getCustomizeField(Long customerId);
List<CustomizeFieldObject> getCustomizeField(Long customerId);
}
package com.viettel.campaign.service;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioAnswerDTO;
import com.viettel.campaign.web.dto.ScenarioDTO;
import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
import com.viettel.campaign.web.dto.*;
import java.util.List;
......@@ -14,7 +11,10 @@ import java.util.List;
public interface ScenarioService {
Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
ResultDTO update(ScenarioDTO scenario);
ResultDTO sortQuestionAndAnswer(ScenarioDTO scenarioDTO);
ResultDTO saveContacQuestResult(ContactQuestResultDTO dto);
}
......@@ -245,7 +245,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
//TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getCompanySiteId()));
if (agents.getUserStatus() != null && agents.getCampaignSystemStatus() != null) {
if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("AVAILABLE")) {
// tạm thời bỏ qua điều kiện này vì DB ACD không thực thi update được
// if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("AVAILABLE")) {
if (agents.getCampaignSystemStatus().equalsIgnoreCase("AVAILABLE")) {
//if (zoneDialMode != null && zoneDialMode.getDialMode().equals(0) || rangeDialMode != null && rangeDialMode.getDialMode().equals(0))
data.put("dialModeManual", "1");
}
......@@ -267,7 +269,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
Agents agents = agentsRepository.findByAgentId(requestDto.getAgentId());
//TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getCompanySiteId()));
//TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getCompanySiteId()));
if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("LOGOUT")) {
// tạm thời bỏ qua điều kiện này vì DB ACD không thực thi update được
// if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("LOGOUT")) {
if (agents.getCampaignSystemStatus().equalsIgnoreCase("LOGOUT")) {
//if (zoneDialMode != null && zoneDialMode.getDialMode().equals(0) || rangeDialMode != null && rangeDialMode.getDialMode().equals(0))
// update acd_full.agents table
Agents a = new Agents();
......
......@@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@Transactional(rollbackFor = Exception.class)
......@@ -405,6 +404,8 @@ public class CampaignServiceImpl implements CampaignService {
// Save campaign to database
campaignRepository.save(campaignEntity);
// Save time dial
timeRangeDialModeRepository.deleteAllByCampaignIdAndCompanySiteId(dto.getCampaignId(), dto.getCompanySiteId());
timeZoneDialModeRepository.deleteAllByCampaignIdAndCompanySiteId(dto.getCampaignId(), dto.getCompanySiteId());
for (TimeRangeDialModeDTO timeRangeDto : lstTimeRange) {
timeRangeDto.setCampaignId(dto.getCampaignId());
TimeRangeDialMode timeRangeEntity = modelMapper.map(timeRangeDto, TimeRangeDialMode.class);
......@@ -480,6 +481,12 @@ public class CampaignServiceImpl implements CampaignService {
return resultDTO;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCampaignCustomerList(CampaignRequestDTO dto) {
return campaignRepositoryCustom.getCampaignCustomerList(dto);
}
// hungtt
private Map<String, String> setMapData(Map<String, String> mapColumn, Locale locale) {
mapColumn.put("CUSTOMER_ID", BundleUtils.getLangString("CUSTOMER_ID", locale));
......
......@@ -233,27 +233,18 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
public ResultDTO update(ScenarioQuestionDTO scenarioQuestionDTO) {
ResultDTO resultDTO = new ResultDTO();
List<ScenarioAnswerDTO> lstAnswers = new ArrayList<>();
List<ScenarioAnswer> lstAnswersToInsert = new ArrayList<>();
if (scenarioQuestionDTO.getScenarioQuestionId() == null) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
return resultDTO;
}
try {
//ScenarioQuestion scenarioQuestion = modelMapper.map(scenarioQuestionDTO, ScenarioQuestion.class);
ScenarioQuestion questionTmp = scenarioQuestionRepository.findScenarioQuestionByScenarioQuestionId(scenarioQuestionDTO.getScenarioQuestionId());
if (questionTmp != null) {
//questionTmp.setCode(scenarioQuestionDTO.getCode());
//questionTmp.setOrderIndex(scenarioQuestionDTO.getOrderIndex());
// questionTmp.setIsDefault(scenarioQuestionDTO.getIsDefault());
// questionTmp.setIsRequire(scenarioQuestionDTO.getIsRequire());
// questionTmp.setQuestion(scenarioQuestionDTO.getQuestion());
// questionTmp.setType(scenarioQuestionDTO.getType());
ScenarioQuestion scenarioQuestion = modelMapper.map(scenarioQuestionDTO, ScenarioQuestion.class);
scenarioQuestionRepository.save(questionTmp);
if (scenarioQuestion.getScenarioQuestionId() != null) {
scenarioQuestionRepository.save(scenarioQuestion);
CampaignLog campaignLog = new CampaignLog();
campaignLog.setCompanySiteId(questionTmp.getCompanySiteId());
campaignLog.setCompanySiteId(scenarioQuestion.getCompanySiteId());
campaignLog.setCreateTime(new Date());
campaignLog.setAgentId(null);
campaignLog.setTableName("SCENARIO_QUESTION");
......@@ -261,46 +252,46 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
campaignLog.setPreValue(null);
campaignLog.setPostValue(null);
campaignLog.setDescription("Chinh sua cau hoi rieng le");
campaignLog.setCampaignId(questionTmp.getCampaignId());
campaignLog.setCustomerId(questionTmp.getScenarioQuestionId());
campaignLog.setCampaignId(scenarioQuestion.getCampaignId());
campaignLog.setCustomerId(scenarioQuestion.getScenarioQuestionId());
campaignLogRepository.save(campaignLog);
// if (scenarioQuestionDTO.getLstAnswers().size() > 0) {
// lstAnswers = scenarioQuestionDTO.getLstAnswers();
//
// lstAnswers.forEach(item -> {
// CampaignLog campaignLogAnswer = new CampaignLog();
// campaignLogAnswer.setCompanySiteId(scenarioQuestion.getCompanySiteId());
// campaignLogAnswer.setCreateTime(new Date());
// campaignLogAnswer.setAgentId(null);
// campaignLogAnswer.setTableName("SCENARIO_ANSWER");
// campaignLogAnswer.setColumnName(null);
// campaignLogAnswer.setPreValue(null);
// campaignLogAnswer.setPostValue(null);
// campaignLogAnswer.setCampaignId(scenarioQuestion.getCampaignId());
//
// if (item.getScenarioAnswerId() != null) {
// ScenarioAnswer answer = modelMapper.map(item, ScenarioAnswer.class);
// scenarioAnswerRepository.save(answer);
// campaignLogAnswer.setCustomerId(answer.getScenarioAnswerId());
// campaignLogAnswer.setDescription("Chinh sua cau tra loi");
// campaignLogRepository.save(campaignLogAnswer);
// } else {
// item.setCode(scenarioQuestion.getScenarioQuestionId() + "_" + item.getOrderIndex());
// item.setScenarioQuestionId(scenarioQuestion.getScenarioQuestionId());
// item.setCreateTime(new Date());
// item.setStatus((short) 1);
// ScenarioAnswer answer = modelMapper.map(item, ScenarioAnswer.class);
// scenarioAnswerRepository.save(answer);
// campaignLogAnswer.setCustomerId(answer.getScenarioAnswerId());
// campaignLogAnswer.setDescription("Them moi cau tra loi");
// campaignLogRepository.save(campaignLogAnswer);
// }
// });
// }
if (scenarioQuestionDTO.getLstAnswers().size() > 0) {
lstAnswers = scenarioQuestionDTO.getLstAnswers();
lstAnswers.forEach(item -> {
CampaignLog campaignLogAnswer = new CampaignLog();
campaignLogAnswer.setCompanySiteId(scenarioQuestion.getCompanySiteId());
campaignLogAnswer.setCreateTime(new Date());
campaignLogAnswer.setAgentId(null);
campaignLogAnswer.setTableName("SCENARIO_ANSWER");
campaignLogAnswer.setColumnName(null);
campaignLogAnswer.setPreValue(null);
campaignLogAnswer.setPostValue(null);
campaignLogAnswer.setCampaignId(scenarioQuestion.getCampaignId());
if (item.getScenarioAnswerId() != null) {
ScenarioAnswer answer = modelMapper.map(item, ScenarioAnswer.class);
scenarioAnswerRepository.save(answer);
campaignLogAnswer.setCustomerId(answer.getScenarioAnswerId());
campaignLogAnswer.setDescription("Chinh sua cau tra loi");
campaignLogRepository.save(campaignLogAnswer);
} else {
item.setCode(scenarioQuestion.getScenarioQuestionId() + "_" + item.getOrderIndex());
item.setScenarioQuestionId(scenarioQuestion.getScenarioQuestionId());
item.setCreateTime(new Date());
item.setStatus((short) 1);
ScenarioAnswer answer = modelMapper.map(item, ScenarioAnswer.class);
scenarioAnswerRepository.save(answer);
campaignLogAnswer.setCustomerId(answer.getScenarioAnswerId());
campaignLogAnswer.setDescription("Them moi cau tra loi");
campaignLogRepository.save(campaignLogAnswer);
}
});
}
}
resultDTO.setData(questionTmp);
resultDTO.setData(scenarioQuestion);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception ex) {
......
package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.model.ccms_full.ScenarioAnswer;
import com.viettel.campaign.model.ccms_full.ScenarioQuestion;
import com.viettel.campaign.repository.ccms_full.ScenarioAnswerRepository;
import com.viettel.campaign.repository.ccms_full.ScenarioQuestionRepository;
import com.viettel.campaign.repository.ccms_full.ScenarioRepository;
import com.viettel.campaign.repository.ccms_full.*;
import com.viettel.campaign.service.ScenarioService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioAnswerDTO;
import com.viettel.campaign.web.dto.ScenarioDTO;
import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
import com.viettel.campaign.web.dto.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Date;
......@@ -46,6 +41,9 @@ public class ScenarioServiceImpl implements ScenarioService {
@Autowired
ModelMapper modelMapper;
@Autowired
ContactQuestResultRepository questResultRepository;
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId) {
......@@ -117,4 +115,21 @@ public class ScenarioServiceImpl implements ScenarioService {
}
return resultDTO;
}
@Override
public ResultDTO saveContacQuestResult(ContactQuestResultDTO dto) {
ResultDTO resultDTO = new ResultDTO();
if (dto != null) {
ContactQuestResult cqr = questResultRepository.save(modelMapper.map(dto, ContactQuestResult.class));
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(cqr);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
}
......@@ -13,14 +13,15 @@ import java.util.ResourceBundle;
public class BundleUtils {
protected static final Logger logger = LoggerFactory.getLogger(BundleUtils.class);
private static volatile ResourceBundle rsConfig = null;
private static final String GLOBAL_CONFIG = "config/globalConfig";
public static String getLangString(String key, Locale... locale) {
Locale vi = new Locale("vi");
Locale mlocale = vi;
try {
if(locale != null) {
if(locale.length == 0) {
if (locale != null) {
if (locale.length == 0) {
rsConfig = ResourceBundle.getBundle(Constants.LANGUAGE.LANGUAGE, mlocale);
} else {
rsConfig = ResourceBundle.getBundle(Constants.LANGUAGE.LANGUAGE, locale[0]);
......@@ -34,4 +35,15 @@ public class BundleUtils {
return key;
}
}
public static String getGlobalConfig(String configKey) {
String result = null;
try {
ResourceBundle bundle = ResourceBundle.getBundle(GLOBAL_CONFIG);
result = bundle.getString(configKey);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return result;
}
}
......@@ -43,4 +43,8 @@ public class Constants {
public interface DATE_FORMAT {
String FOMART_DATE_TYPE_1 = "DD/MM/YYYY";
}
public interface MIME_TYPE {
String EXCEL_XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
}
}
......@@ -5,14 +5,14 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.io.Serializable;
//import java.io.Serializable;
import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ContactCusResDTO implements Serializable {
public class ContactCusResDTO {
private Long contactCustResultId;
private String campaignCode;
private String campaignName;
......@@ -27,4 +27,5 @@ public class ContactCusResDTO implements Serializable {
private String recordStatus;
private Long callTime;
private Boolean enableEdit;
private Integer totalRow;
}
......@@ -25,4 +25,7 @@ public class CustomerListDTO extends BaseDTO {
private Long totalCusInList;
private Long totalCusInteract;
private Long totalCusNotInteract;
private Long totalCusList;
private Long totalCusCampaign;
private Long totalCusCalled;
}
......@@ -247,4 +247,17 @@ public class CampaignController {
ResultDTO result = campaignExecuteService.getCustomerRecall(campaignId, customerId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/getCampaignCustomerList")
@ResponseBody
public ResponseEntity getCampaignCustomerList(@RequestBody CampaignRequestDTO campaignRequestDTO) {
ResultDTO resultDTO = campaignService.getCampaignCustomerList(campaignRequestDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@RequestMapping(value = "/renewCampaign", method = RequestMethod.PUT)
public ResponseEntity<ResultDTO> renewCampaign(@RequestBody CampaignDTO campaignDTO) {
ResultDTO result = campaignService.renewCampaign(campaignDTO);
return new ResponseEntity<>(result, HttpStatus.OK);
}
}
package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.CustomizeFieldObject;
import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.utils.BundleUtils;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.econtact.filter.UserSession;
import org.apache.log4j.Logger;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.commons.io.FilenameUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -21,17 +25,19 @@ import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.io.File;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.*;
@Controller
@RequestMapping("/ipcc/customer")
@CrossOrigin(origins = "*")
public class CustomerController {
private static final Logger LOGGER = Logger.getLogger(CustomerController.class);
private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class);
@Autowired(required=true)
@Autowired(required = true)
CustomerService customerService;
@GetMapping("/findAll")
......@@ -160,17 +166,15 @@ public class CustomerController {
return new ResponseEntity(result, HttpStatus.OK);
}
//<editor-fold desc="Download and import excel" defaultState="collapsed">
//<editor-fold desc="Download and import excel" defaultstate="collapsed">
@GetMapping(value = "/downloadFileTemplate")
public ResponseEntity<byte[]> downloadFileTemplate(@RequestParam("companySiteId") Long companySiteId) {
LOGGER.debug("--------DOWNLOAD FILE TEMPLATE---------");
LOGGER.info("--------DOWNLOAD FILE TEMPLATE---------");
try {
customerService.buildTemplate(companySiteId);
File file = ResourceUtils.getFile("classpath:templates/import_customer_template.xlsx");
byte[] content = Files.readAllBytes(file.toPath());
byte[] content = customerService.buildTemplate(companySiteId);
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName())
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=template_import_customer.xlsx")
.header("Content-Type", Constants.MIME_TYPE.EXCEL_XLSX)
.body(content);
} catch (Exception e) {
LOGGER.error(e.getMessage());
......@@ -179,39 +183,29 @@ public class CustomerController {
}
@PostMapping(value = "/importFile")
public ResponseEntity<byte[]> importFile(@RequestParam("file") MultipartFile file) {
LOGGER.debug("--------IMPORT FILE TEMPLATE---------");
public ResponseEntity<?> importFile(@RequestParam("file") MultipartFile file,
@RequestParam("customerListId") Long customerListId,
@RequestHeader("X-Auth-Token") String authToken) {
LOGGER.info("------------IMPORT FILE TEMPLATE--------------");
Locale locale = new Locale("vi", "VN");
try {
List<CustomerDTO> listCustomer = new ArrayList<>();
XSSFWorkbook workbook = new XSSFWorkbook(file.getInputStream());
XSSFSheet sheet = workbook.getSheetAt(0);
for (int i = 0; i < sheet.getPhysicalNumberOfRows(); i++) {
CustomerDTO customer = new CustomerDTO();
XSSFRow row = sheet.getRow(i);
customer.setCustomerId(Double.valueOf(row.getCell(0).getNumericCellValue()).longValue());
customer.setCreateDate(row.getCell(1).getDateCellValue());
customer.setName(row.getCell(2).getStringCellValue());
listCustomer.add(customer);
UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken);
if (file.isEmpty()) {
return new ResponseEntity<>(BundleUtils.getLangString("customer.fileNotSelected"), HttpStatus.OK);
}
// for (int i = 0; i < listCustomer.size(); i++) {
// validate du lieu
// }
// if (okay) {
// for (int i = 0; i < listCustomer.size(); i++) {
// customerService.createCustomer(listCustomer.get(i));
// }
// return ResponseEntity.ok()
// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName())
// .contentType(MediaType.APPLICATION_OCTET_STREAM)
// .body(file.getBytes());
// } else {
// return ResponseEntity.ok()
// .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + file.getName())
// .header("Message", "Validate failed!")
// .contentType(MediaType.APPLICATION_OCTET_STREAM)
// .body(file.getBytes());
// }
return null;
if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
return new ResponseEntity<>(BundleUtils.getLangString("customer.invalidTemplate", locale), HttpStatus.OK);
}
String path = saveUploadFile(file);
List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, customerListId);
File fileExport = (File) map.get("file");
String message = (String) map.get("message");
return ResponseEntity.ok()
.header("Content-Type", Constants.MIME_TYPE.EXCEL_XLSX)
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=template_import_customer.xlsx")
.header("Message", message)
.body(Files.readAllBytes(fileExport.toPath()));
} catch (Exception e) {
LOGGER.error(e.getMessage());
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
......@@ -233,7 +227,25 @@ public class CustomerController {
@PostMapping("/getCustomizeField")
public ResponseEntity<?> getCustomizeField(@RequestBody Long customerId) {
List<CustomizeFieldDTO> data = customerService.getCustomizeField(customerId);
List<CustomizeFieldObject> data = customerService.getCustomizeField(customerId);
return new ResponseEntity<>(data, HttpStatus.OK);
}
private String saveUploadFile(MultipartFile file) {
try {
String currentTime = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss").format(new Date());
String fileName = FilenameUtils.getBaseName(file.getOriginalFilename()) + "_" + currentTime + "." + FilenameUtils.getExtension(file.getOriginalFilename());
byte[] content = file.getBytes();
File uploadFolder = new File(BundleUtils.getGlobalConfig("import.uploadFolder"));
if (!uploadFolder.exists()) {
uploadFolder.mkdir();
}
Path path = Paths.get(BundleUtils.getGlobalConfig("import.uploadFolder"), fileName);
Files.write(path, content);
return path.toString();
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
return null;
}
}
......@@ -2,6 +2,7 @@ package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.service.ScenarioService;
import com.viettel.campaign.web.dto.ContactQuestResultDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioDTO;
import org.slf4j.Logger;
......@@ -19,11 +20,13 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/ipcc/campaign/scenario")
@CrossOrigin
public class ScenarioController {
private static final Logger logger = LoggerFactory.getLogger(ScenarioController.class);
@Autowired
ScenarioService scenarioService;
@RequestMapping(value="/findOneByCampaignIdAndCompanyId", method = RequestMethod.GET)
@RequestMapping(value = "/findOneByCampaignIdAndCompanyId", method = RequestMethod.GET)
Scenario findOneByCampaignIdAndCompanyId(@RequestParam Long campaignId, @RequestParam Long companySiteId) {
return scenarioService.findScenarioByCampaignIdAndCompanySiteId(campaignId, companySiteId);
}
......@@ -39,4 +42,10 @@ public class ScenarioController {
ResultDTO resultDTO = scenarioService.sortQuestionAndAnswer(scenarioDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@RequestMapping(value = "/saveContactQuestResult", method = RequestMethod.POST)
ResponseEntity<ResultDTO> saveContactQuestResult(@RequestBody ContactQuestResultDTO dto) {
ResultDTO resultDTO = scenarioService.saveContacQuestResult(dto);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
}
#DEV
import.uploadFolder=D:/temp/upload
#STAGGING
#import.uploadFolder=/root/temp/
#PROD
#import.uploadFolder=/root/temp/
......@@ -67,3 +67,39 @@ IPCC_STATUS = IPCC_STATUS
EMAIL = EMAIL
CUSTOMER_TYPE = CUSTOMER_TYPE
AVATAR_LINK = AVATAR_LINK
#Customer Excel Header
customer.no = No
customer.fullname = Full Name#Required\nLetters only\nmaximum 1000 characters
customer.mainPhone = Main mobile phone#Number only\nmultiple numbers allowed\neach seperate by semicolon\nmaximum 50 characters
customer.secondPhone = Secondary phone#Number only\nmultiple numbers allowed\neach seperate by semicolon\nmaximum 50 characters
customer.email = Email#multiple emails allowed\neach seperate by semicolon\nmaximum 100 characters
customer.address = Address#maximum 500 characters
customer.cusType = Customer Type
customer.companyName = Company#maximum 100 characters
customer.description = Description#maximum 2000 characters
customer.callAllowed = Call Allowed
customer.emailAllowed = Email Allowed
customer.smsAllowed = Sms Allowed
customer.result = Result
customer.cusType.normal = Normal
customer.cusType.vip = VIP
customer.cusType.blacklist = Blacklist
customer.yes = Yes
customer.not = No
customer.invalidTemplate = Invalid Template
customer.noData = Template empty
customer.nameRequired = Full name required;
customer.emailMax50 = Email must less than 50 character;
customer.invalidCustomer = All 3 fields Main phone, second phone and email must not null;
customer.importSuccess = Import Successful
customer.importFailed = Import Failed
customer.errorValidate = Error while validating
customer.phoneMax50 = Mobile phone must less than 50 character;
customer.phoneExists = Mobile phone exists;
customer.notMatch = not match regexp validation
customer.notGreaterThan = not greater than
customer.notLessThan = not less than
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.fileNotSelected=Please select a file
......@@ -69,3 +69,39 @@ IPCC_STATUS = IPCC_STATUS
EMAIL = EMAIL
CUSTOMER_TYPE = CUSTOMER_TYPE
AVATAR_LINK = AVATAR_LINK
#Customer Excel Header
customer.no = STT
customer.fullname = Họ và tên#Bắt buộc\nĐịnh dạng chữ\ntối đa 1000 kí tự
customer.mainPhone = Số điện thoại chính#Định dạng số\ncho phép nhập nhiều số điện thoại chính\ncác số cách nhau bởi dấu chấm phấy\ntối đa 50 ký tự
customer.secondPhone = Số điện thoại phụ#Định dạng số\ncho phép nhập nhiều số điện thoại phụ\ncác số cách nhau bởi dấu chấm phấy hoặc dấu phẩy\ntối đa 50 ký tự
customer.email=Email#Cho phép nhập nhiều email\nmỗi email cách nhau bởi dấu \";\"\ntối đa 100 ký tự
customer.address = Địa chỉ#Tối đa 500 ký tự
customer.cusType = Loại khách hàng
customer.companyName = Công ty#Tối đa 100 ký tự
customer.description = Ghi chú#Tối đa 2000 ký tự
customer.callAllowed = Cho phép gọi ra
customer.emailAllowed = Cho phép gửi email
customer.smsAllowed = Cho phép gửi sms
customer.result = Kết quả
customer.cusType.normal = Thường
customer.cusType.vip = VIP
customer.cusType.blacklist = Blacklist
customer.yes =
customer.not = Không
customer.invalidTemplate = Template sai định dạng
customer.noData = Template không có dữ liệu
customer.nameRequired = Họ và tên không được để trống;
customer.emailMax50 = Email không được quá 50 kí tự;
customer.invalidCustomer = Cả 3 thông tin số điện thoại chính, số điện phụ và email không được để trống;
customer.importSuccess = Import dữ liệu thành công
customer.importFailed = Import dữ liệu thất bại
customer.errorValidate = Validate dữ liệu lỗi
customer.phoneMax50 = Số điện thoại không được quá 50 kí tự;
customer.phoneExists = Số điện thoại chính đã tồn tại;
customer.notMatch = không đúng định dạng
customer.notGreaterThan = không được lớn hơn
customer.notLessThan = không được nhỏ hơn
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.fileNotSelected=Bạn chưa chọn file
select CUSTOMIZE_FIELD_OBJECT_ID customizeFieldObjectId,
OBJECT_ID objectId,
CUSTOMIZE_FIELDS_ID customizeFieldId,
VALUE_TEXT valueText,
VALUE_NUMBER valueNumber,
VALUE_DATE valueDate,
VALUE_CHECKBOX valueCheckbox,
CREATE_BY createBy,
CREATE_DATE createDate,
UPDATE_BY updateBy,
UPDATE_DATE updateDate,
STATUS status,
FIELD_OPTION_VALUE_ID fieldOptionValueId,
TITLE title,
FUNCTION_CODE functionCode
from customize_field_object
where function_code = 'CUSTOMER' and object_id = :p_customer_id
\ No newline at end of file
with customer_table as (
select count(a.customer_id) totalCustomer, a.customer_list_id customerListId from customer_list_mapping a
left join customer b on a.customer_id = b.customer_id
where b.status = 1
group by a.customer_list_id
),
campaign_customer_table as (
select count(a.customer_id) campaignCustomer, a.customer_list_id customerListId, a.campaign_id from campaign_customer a
where a.campaign_id = :p_campaign_id
group by a.customer_list_id, a.campaign_id
),
customer_interactive_table as (
select count(a.customer_id) campaignCustomerCalled, a.customer_list_id customerListId, a.campaign_id from campaign_customer a
where a.status <> 0 and a.campaign_id = :p_campaign_id
group by a.customer_list_id, a.campaign_id
),
customer_not_interactive_table as (
select count(a.customer_id) cusNotInteractive, a.customer_list_id customerListId, a.campaign_id from campaign_customer a
where a.status = 0 and a.campaign_id = :p_campaign_id and a.in_campaign_status = 1
group by a.customer_list_id, a.campaign_id
)
select a.customer_list_id customerListId,
a.customer_list_code customerListCode,
a.customer_list_name customerListName,
nvl(b.totalCustomer, 0) totalCusList,
nvl(c.campaignCustomer, 0) totalCusCampaign,
nvl(d.campaignCustomerCalled, 0) totalCusCalled,
nvl(e.cusNotInteractive, 0) totalCusNotInteract
from customer_list a
left join customer_table b on a.customer_list_id = b.customerListId
left join campaign_customer_table c on a.customer_list_id = c.customerListId
left join customer_interactive_table d on a.customer_list_id = d.customerListId
left join customer_not_interactive_table e on a.customer_list_id = e.customerListId
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