Commit 0ceeafdb authored by Tu Bach's avatar Tu Bach

Merge branch 'master' into tubn

parents 00ae8d83 17f6c980
File deleted
sonar.host.url=http://192.168.1.210:9000
sonar.sourceEncoding=UTF-8
sonar.projectKey=0ad5d5fb7aa141b4ac383bcb096e2ec3faba0b1b
sonar.projectName=VTT_CAMPAIGN
sonar.projectVersion=1.0
sonar.sources=.
sonar.language=java
mvn sonar:sonar -Dsonar.host.url=http://192.168.1.210:9000 -Dsonar.login=0ad5d5fb7aa141b4ac383bcb096e2ec3faba0b1b
\ No newline at end of file
...@@ -9,10 +9,10 @@ import java.util.Date; ...@@ -9,10 +9,10 @@ import java.util.Date;
@Entity @Entity
@Table(name = "CUSTOMIZE_FIELDS") @Table(name = "CUSTOMIZE_FIELDS")
@Getter //@Getter
@Setter //@Setter
@NoArgsConstructor //@NoArgsConstructor
@AllArgsConstructor //@AllArgsConstructor
public class CustomizeFields implements Serializable { public class CustomizeFields implements Serializable {
@Id @Id
@GeneratedValue(generator = "CUSTOMIZE_FIELDS_SEQ") @GeneratedValue(generator = "CUSTOMIZE_FIELDS_SEQ")
...@@ -64,10 +64,180 @@ public class CustomizeFields implements Serializable { ...@@ -64,10 +64,180 @@ public class CustomizeFields implements Serializable {
@Column(name = "ACTIVE") @Column(name = "ACTIVE")
private Long active; private Long active;
public CustomizeFields(@NotNull String type, @NotNull String title) { public CustomizeFields() {
}
public CustomizeFields(String type, String title) {
// public CustomizeFields(@NotNull String type, @NotNull String title) {
this.type = type; this.type = type;
this.title = title; this.title = title;
} }
public Long getCustomizeFieldId() {
return customizeFieldId;
}
public void setCustomizeFieldId(Long customizeFieldId) {
this.customizeFieldId = customizeFieldId;
}
public Long getSiteId() {
return siteId;
}
public void setSiteId(Long siteId) {
this.siteId = siteId;
}
public String getFunctionCode() {
return functionCode;
}
public void setFunctionCode(String functionCode) {
this.functionCode = functionCode;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Long getStatus() {
return status;
}
public void setStatus(Long status) {
this.status = status;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getPlaceholder() {
return placeholder;
}
public void setPlaceholder(String placeholder) {
this.placeholder = placeholder;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getPosition() {
return position;
}
public void setPosition(Long position) {
this.position = position;
}
public Long getRequired() {
return required;
}
public void setRequired(Long required) {
this.required = required;
}
public Long getFieldOptionsId() {
return fieldOptionsId;
}
public void setFieldOptionsId(Long fieldOptionsId) {
this.fieldOptionsId = fieldOptionsId;
}
public String getRegexpForValidation() {
return regexpForValidation;
}
public void setRegexpForValidation(String regexpForValidation) {
this.regexpForValidation = regexpForValidation;
}
public Long getMaxLength() {
return maxLength;
}
public void setMaxLength(Long maxLength) {
this.maxLength = maxLength;
}
public Long getMinLength() {
return minLength;
}
public void setMinLength(Long minLength) {
this.minLength = minLength;
}
public Long getMin() {
return min;
}
public void setMin(Long min) {
this.min = min;
}
public Long getMax() {
return max;
}
public void setMax(Long max) {
this.max = max;
}
public Long getActive() {
return active;
}
public void setActive(Long active) {
this.active = active;
}
} }
...@@ -91,6 +91,8 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom ...@@ -91,6 +91,8 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
CampaignCustomer findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(Long campaignId, Long companySiteId, Long customerId); CampaignCustomer findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(Long campaignId, Long companySiteId, Long customerId);
List<CampaignCustomer> findCampaignCustomersByCampaignIdAndCompanySiteIdAndCustomerIdAndInCampaignStatus(Long campaignId, Long companySiteId, Long customerId, Short inCampaingStatus);
@Query(value = "select complete_value from campaign_complete_code where status = 1 and is_finish = 0 and is_recall = 0", nativeQuery = true) @Query(value = "select complete_value from campaign_complete_code where status = 1 and is_finish = 0 and is_recall = 0", nativeQuery = true)
List<Short> getStatus(); List<Short> getStatus();
} }
package com.viettel.campaign.repository.ccms_full; package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.web.dto.CampaignDTO; import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.web.dto.ResultDTO; import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO; import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -36,5 +36,7 @@ public interface CampaignRepositoryCustom { ...@@ -36,5 +36,7 @@ public interface CampaignRepositoryCustom {
ResultDTO getCampaignCustomerInformation(CampaignRequestDTO dto); ResultDTO getCampaignCustomerInformation(CampaignRequestDTO dto);
ResultDTO getCustomerListInformation(CampaignRequestDTO dto); ResultDTO getCustomerListInformation(CampaignRequestDTO dto);
List<ApParamDTO> getConnectStatus(Long companySiteId);
//</editor-fold> //</editor-fold>
} }
...@@ -12,5 +12,5 @@ public interface CustomerContactRepository extends JpaRepository<CustomerContact ...@@ -12,5 +12,5 @@ public interface CustomerContactRepository extends JpaRepository<CustomerContact
@Query("FROM CustomerContact WHERE status = 1 AND customerId = :customerId AND contactType = :contactType AND (contact IS NULL OR UPPER(contact) LIKE UPPER(concat('%', :contact, '%')))") @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); List<CustomerContact> findByCustomerIdAndAndContactTypeAndContact(@Param("customerId") Long customerId, @Param("contactType") Short contactType, @Param("contact") String contact, Pageable pageable);
CustomerContact findCustomerContactByContactEquals(String contact); List<CustomerContact> findCustomerContactsByContactEquals(String contact);
} }
...@@ -39,6 +39,6 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> { ...@@ -39,6 +39,6 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
@Query(value = "select * from customer a\n" + @Query(value = "select * from customer a\n" +
"left join customer_list_mapping b on a.customer_id = b.customer_id\n" + "left join customer_list_mapping b on a.customer_id = b.customer_id\n" +
"where b.customer_list_id = :p_customer_list_id\n" + "where b.customer_list_id = :p_customer_list_id\n" +
" and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id)", nativeQuery = true) " and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id and cc.in_campaign_status <> 0)", nativeQuery = true)
List<Customer> findAllCutomerNotInCampagin(@Param("p_customer_list_id") Long customerListId, @Param("p_campaign_id") Long campaignId); List<Customer> findAllCutomerNotInCampagin(@Param("p_customer_list_id") Long customerListId, @Param("p_campaign_id") Long campaignId);
} }
...@@ -67,7 +67,7 @@ public class CampaignCustomerListColumnRepositoryImpl implements CampaignCustome ...@@ -67,7 +67,7 @@ public class CampaignCustomerListColumnRepositoryImpl implements CampaignCustome
data = query.list(); data = query.list();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} finally { } finally {
session.close(); session.close();
} }
......
...@@ -66,7 +66,7 @@ public class CampaignCustomerRepositoryImpl implements CampaignCustomerRepositor ...@@ -66,7 +66,7 @@ public class CampaignCustomerRepositoryImpl implements CampaignCustomerRepositor
result = query.list(); result = query.list();
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); // ex.printStackTrace();
} finally { } finally {
session.close(); session.close();
} }
......
...@@ -579,7 +579,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -579,7 +579,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
return result; return result;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return result; return result;
......
...@@ -127,20 +127,20 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -127,20 +127,20 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if (!DataUtil.isNullOrEmpty(requestDto.getCampaignName())) { if (!DataUtil.isNullOrEmpty(requestDto.getCampaignName())) {
sb.append(" AND UPPER(a.CAMPAIGN_NAME) LIKE :p_name"); sb.append(" AND UPPER(a.CAMPAIGN_NAME) LIKE :p_name");
} }
if (requestDto.getStatus() != null && requestDto.getStatus() >= 0) { if (!DataUtil.isNullOrEmpty(requestDto.getStatuses())) {
sb.append(" AND a.STATUS = :p_status"); sb.append(" AND a.STATUS IN (:p_statuses) ");
} }
if (!DataUtil.isNullOrEmpty(requestDto.getFromDateFr())) { if (!DataUtil.isNullOrEmpty(requestDto.getFromDateFr())) {
sb.append(" AND TO_DATE(a.START_TIME, 'DD/MM/YYYY') >= :p_frDateFr"); sb.append(" AND TO_DATE(a.START_TIME, 'DD-MM-RR') >= TO_DATE(:p_frDateFr, 'YYYYMMDD')");
} }
if (!DataUtil.isNullOrEmpty(requestDto.getToDateFr())) { if (!DataUtil.isNullOrEmpty(requestDto.getToDateFr())) {
sb.append(" AND TO_DATE(a.START_TIME, 'DD/MM/YYYY') <= :p_toDateFr"); sb.append(" AND TO_DATE(a.START_TIME, 'DD-MM-RR') <= TO_DATE(:p_toDateFr, 'YYYYMMDD')");
} }
if (!DataUtil.isNullOrEmpty(requestDto.getFromDateTo())) { if (!DataUtil.isNullOrEmpty(requestDto.getFromDateTo())) {
sb.append(" AND TO_DATE(a.END_TIME, 'DD/MM/YYYY') >= :p_frDateTo"); sb.append(" AND TO_DATE(a.END_TIME, 'DD-MM-RR') >= TO_DATE(:p_frDateTo, 'YYYYMMDD')");
} }
if (!DataUtil.isNullOrEmpty(requestDto.getToDateTo())) { if (!DataUtil.isNullOrEmpty(requestDto.getToDateTo())) {
sb.append(" AND TO_DATE(a.END_TIME, 'DD/MM/YYYY') <= :p_toDateTo"); sb.append(" AND TO_DATE(a.END_TIME, 'DD-MM-RR') <= TO_DATE(:p_toDateTo, 'YYYYMMDD')");
} }
if (!DataUtil.isNullOrZero(requestDto.getNumOfCusFr())) { if (!DataUtil.isNullOrZero(requestDto.getNumOfCusFr())) {
sb.append(" AND a.CUSTOMER_NUMBER >= :p_cusNumFr"); sb.append(" AND a.CUSTOMER_NUMBER >= :p_cusNumFr");
...@@ -151,8 +151,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -151,8 +151,8 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
if (!DataUtil.isNullOrEmpty(requestDto.getTypes())) { if (!DataUtil.isNullOrEmpty(requestDto.getTypes())) {
sb.append(" AND a.CAMPAIGN_TYPE IN (:p_type)"); sb.append(" AND a.CAMPAIGN_TYPE IN (:p_type)");
} }
if (requestDto.getChanel() != null && !DataUtil.isNullOrZero(requestDto.getChanel())) { if (!DataUtil.isNullOrEmpty(requestDto.getChannels())) {
sb.append(" AND a.CHANEL = :p_chanel"); sb.append(" AND a.CHANEL IN (:p_channels)");
} }
if (!DataUtil.isNullOrZero(requestDto.getNumOfCusFr())) { if (!DataUtil.isNullOrZero(requestDto.getNumOfCusFr())) {
sb.append(" AND a.CUSTOMER_NUMBER >= :p_cusNumFr"); sb.append(" AND a.CUSTOMER_NUMBER >= :p_cusNumFr");
...@@ -165,7 +165,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -165,7 +165,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
SQLQuery query = session.createSQLQuery(sb.toString()); SQLQuery query = session.createSQLQuery(sb.toString());
if (!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) { if (!DataUtil.isNullOrEmpty(requestDto.getCampaignCode())) {
String[] lstCode = requestDto.getCampaignCode().split(","); String[] lstCode = requestDto.getCampaignCode().trim().split(",");
query.setParameterList("p_code", lstCode); query.setParameterList("p_code", lstCode);
} }
...@@ -173,15 +173,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -173,15 +173,16 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
query.setParameter("p_name", "%" + query.setParameter("p_name", "%" +
requestDto.getCampaignName().trim().toUpperCase() requestDto.getCampaignName().trim().toUpperCase()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\\\_") .replaceAll("_", "\\_")
+ "%"); + "%");
} }
query.setParameter("p_company_site_id", requestDto.getCompanySiteId()); query.setParameter("p_company_site_id", requestDto.getCompanySiteId());
if (requestDto.getStatus() != null && requestDto.getStatus() >= 0) { if (!DataUtil.isNullOrEmpty(requestDto.getStatuses())) {
query.setParameter("p_status", requestDto.getStatus()); String[] statuses = requestDto.getStatuses().split(",");
query.setParameterList("p_statuses", statuses);
} }
if (!DataUtil.isNullOrEmpty(requestDto.getFromDateFr())) { if (!DataUtil.isNullOrEmpty(requestDto.getFromDateFr())) {
query.setParameter("p_frDateFr", requestDto.getFromDateFr()); query.setParameter("p_frDateFr", requestDto.getFromDateFr());
...@@ -199,8 +200,9 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -199,8 +200,9 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
String[] types = requestDto.getTypes().split(","); String[] types = requestDto.getTypes().split(",");
query.setParameterList("p_type", types); query.setParameterList("p_type", types);
} }
if (requestDto.getChanel() != null && !DataUtil.isNullOrZero(requestDto.getChanel())) { if (!DataUtil.isNullOrEmpty(requestDto.getChannels())) {
query.setParameter("p_chanel", requestDto.getChanel()); String[] channels = requestDto.getChannels().split(",");
query.setParameterList("p_channels", channels);
} }
if (!DataUtil.isNullOrZero(requestDto.getNumOfCusFr())) { if (!DataUtil.isNullOrZero(requestDto.getNumOfCusFr())) {
query.setParameter("p_cusNumFr", requestDto.getNumOfCusFr() == 0 ? null : requestDto.getNumOfCusFr()); query.setParameter("p_cusNumFr", requestDto.getNumOfCusFr() == 0 ? null : requestDto.getNumOfCusFr());
...@@ -619,12 +621,12 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -619,12 +621,12 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"),\n" + "),\n" +
"campaign_customer_table as (\n" + "campaign_customer_table as (\n" +
" select count(a.customer_id) campaignCustomer, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" + " select count(a.customer_id) campaignCustomer, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.campaign_id = :p_campaign_id\n" + " where a.campaign_id = :p_campaign_id and in_campaign_status = 1\n" +
" group by a.customer_list_id, a.campaign_id\n" + " group by a.customer_list_id, a.campaign_id\n" +
"),\n" + "),\n" +
"customer_interactive_table as (\n" + "customer_interactive_table as (\n" +
" select count(a.customer_id) campaignCustomerCalled, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" + " select count(a.customer_id) campaignCustomerCalled, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.status <> 0 and a.campaign_id = :p_campaign_id\n" + " where a.status <> 0 and a.campaign_id = :p_campaign_id and in_campaign_status = 1\n" +
" group by a.customer_list_id, a.campaign_id\n" + " group by a.customer_list_id, a.campaign_id\n" +
"),\n" + "),\n" +
"customer_not_interactive_table as (\n" + "customer_not_interactive_table as (\n" +
...@@ -652,7 +654,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -652,7 +654,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"where a.totalCusCampaign > 0" + "where a.totalCusCampaign > 0" +
"),\n" + "),\n" +
"count_data as (\n" + "count_data as (\n" +
"select count(*) totalRow from data_temp\n" + "select count(*) totalRow from data\n" +
")\n" + ")\n" +
"select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusCampaign, a.totalCusCalled, a.totalCusNotInteract, totalRow from data a, count_data\n" + "select a.customerListId, a.customerListCode, a.customerListName, a.totalCusList, a.totalCusCampaign, a.totalCusCalled, a.totalCusNotInteract, totalRow from data a, count_data\n" +
"where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)\n"; "where row_ >= ((:p_page_number - 1) * :p_page_size + 1) and row_ < (:p_page_number * :p_page_size + 1)\n";
...@@ -912,7 +914,11 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -912,7 +914,11 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
sb.append(" sum(case"); sb.append(" sum(case");
sb.append(" when status in (select * from status_customer) then 1"); sb.append(" when status in (select * from status_customer) then 1");
sb.append(" else 0"); sb.append(" else 0");
sb.append(" end) totalNotCall"); sb.append(" end) totalNotCall,");
sb.append(" sum(case");
sb.append(" when customer_list_id is not null and in_campaign_status = 1 then 1");
sb.append(" else 0");
sb.append(" end) totalCusInList");
sb.append(" from campaign_customer"); sb.append(" from campaign_customer");
sb.append(" group by campaign_id"); sb.append(" group by campaign_id");
sb.append(" )"); sb.append(" )");
...@@ -990,4 +996,22 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -990,4 +996,22 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
return resultDTO; return resultDTO;
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public List<ApParamDTO> getConnectStatus(Long companySiteId) {
List<ApParamDTO> list = new ArrayList<>();
Map<String, Object> params = new HashMap<>();
try {
StringBuilder sb = new StringBuilder();
sb.append(" select complete_value apParamId, complete_name parName ");
sb.append(" from campaign_complete_code ");
sb.append(" where complete_type = 1 and complete_value <> 1 and company_site_id = :p_company_site_id");
params.put("p_company_site_id", companySiteId);
list = namedParameterJdbcTemplate.query(sb.toString(), params, BeanPropertyRowMapper.newInstance(ApParamDTO.class));
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return list;
}
} }
...@@ -54,7 +54,7 @@ public class TicketRepositoryImpl implements TicketRepositoryCustom { ...@@ -54,7 +54,7 @@ public class TicketRepositoryImpl implements TicketRepositoryCustom {
return lst; return lst;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return lst; return lst;
......
...@@ -10,7 +10,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; ...@@ -10,7 +10,6 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
public interface CampaignService { public interface CampaignService {
...@@ -72,6 +71,8 @@ public interface CampaignService { ...@@ -72,6 +71,8 @@ public interface CampaignService {
ResultDTO getCustomerListInformation(CampaignRequestDTO dto); ResultDTO getCustomerListInformation(CampaignRequestDTO dto);
ResultDTO saveCustomerCampaign(CampaignRequestDTO dto); ResultDTO saveCustomerCampaign(CampaignRequestDTO dto);
ResultDTO getConnectStatus(Long companySiteId);
//</editor-fold> //</editor-fold>
} }
...@@ -54,7 +54,7 @@ public class AgentsServiceImpl implements AgentsService { ...@@ -54,7 +54,7 @@ public class AgentsServiceImpl implements AgentsService {
result.setDescription("agents data null"); result.setDescription("agents data null");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return result; return result;
...@@ -251,7 +251,7 @@ public class AgentsServiceImpl implements AgentsService { ...@@ -251,7 +251,7 @@ public class AgentsServiceImpl implements AgentsService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
...@@ -274,7 +274,7 @@ public class AgentsServiceImpl implements AgentsService { ...@@ -274,7 +274,7 @@ public class AgentsServiceImpl implements AgentsService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
...@@ -301,32 +301,39 @@ public class AgentsServiceImpl implements AgentsService { ...@@ -301,32 +301,39 @@ public class AgentsServiceImpl implements AgentsService {
StringBuilder sqlStrBuilder = new StringBuilder(); StringBuilder sqlStrBuilder = new StringBuilder();
sqlStrBuilder.append("SELECT"); sqlStrBuilder.append("SELECT");
sqlStrBuilder.append(" a.USER_ID userId,"); sqlStrBuilder.append(" vu.USER_ID userId,");
sqlStrBuilder.append(" a.USER_NAME userName,"); sqlStrBuilder.append(" vu.USER_NAME userName,");
sqlStrBuilder.append(" a.STATUS status,"); sqlStrBuilder.append(" vu.STATUS status,");
sqlStrBuilder.append(" a.FULL_NAME fullName,"); sqlStrBuilder.append(" vu.FULL_NAME fullName,");
sqlStrBuilder.append(" a.COMPANY_SITE_ID companySiteId,"); sqlStrBuilder.append(" vu.COMPANY_SITE_ID companySiteId,");
sqlStrBuilder.append(" b.FILTER_TYPE filterType,"); sqlStrBuilder.append(" r.ROLE_CODE roleCode");
sqlStrBuilder.append(" b.CAMPAIGN_AGENT_ID campaignAgentId"); sqlStrBuilder.append(" FROM VSA_USERS vu");
sqlStrBuilder.append(" FROM VSA_USERS a"); sqlStrBuilder.append(" INNER JOIN USER_ROLE ur on vu.USER_ID = ur.USER_ID");
sqlStrBuilder.append(" LEFT JOIN CAMPAIGN_AGENT b on a.USER_ID = b.AGENT_ID"); sqlStrBuilder.append(" INNER JOIN ROLE r on ur.ROLE_ID = r.ROLE_ID");
sqlStrBuilder.append(" INNER JOIN USER_ROLE c on a.USER_ID = c.USER_ID");
sqlStrBuilder.append(" INNER JOIN ROLE d on c.ROLE_ID = d.ROLE_ID");
sqlStrBuilder.append(" WHERE 1 = 1"); sqlStrBuilder.append(" WHERE 1 = 1");
sqlStrBuilder.append(" AND a.COMPANY_SITE_ID = :p_company_site_id"); sqlStrBuilder.append(" AND vu.COMPANY_SITE_ID = :p_company_site_id");
sqlStrBuilder.append(" AND vu.STATUS = 1");
sqlStrBuilder.append(" AND r.ROLE_CODE IN ('AGENT', 'SUPERVISOR')");
sqlStrBuilder.append(" AND vu.USER_ID NOT IN (SELECT vu.USER_ID userId");
sqlStrBuilder.append(" FROM VSA_USERS vu");
sqlStrBuilder.append(" LEFT JOIN CAMPAIGN_AGENT ca on vu.USER_ID = ca.AGENT_ID");
sqlStrBuilder.append(" INNER JOIN USER_ROLE ur on vu.USER_ID = ur.USER_ID");
sqlStrBuilder.append(" INNER JOIN ROLE r on ur.ROLE_ID = r.ROLE_ID");
sqlStrBuilder.append(" WHERE 1 = 1");
sqlStrBuilder.append(" AND vu.COMPANY_SITE_ID = :p_company_site_id");
sqlStrBuilder.append(" AND vu.STATUS = 1");
sqlStrBuilder.append(" AND ca.CAMPAIGN_ID = :p_campaign_id");
sqlStrBuilder.append(" AND r.ROLE_CODE IN ('AGENT', 'SUPERVISOR'))");
if (!DataUtil.isNullOrEmpty(userName)) { if (!DataUtil.isNullOrEmpty(userName)) {
sqlStrBuilder.append(" AND UPPER(a.USER_NAME) LIKE UPPER(:p_user_name)"); sqlStrBuilder.append(" AND UPPER(vu.USER_NAME) LIKE UPPER(:p_user_name)");
} }
if (!DataUtil.isNullOrEmpty(fullName)) { if (!DataUtil.isNullOrEmpty(fullName)) {
sqlStrBuilder.append(" AND UPPER(a.FULL_NAME) LIKE UPPER(:p_full_name)"); sqlStrBuilder.append(" AND UPPER(vu.FULL_NAME) LIKE UPPER(:p_full_name)");
} }
sqlStrBuilder.append(" AND d.ROLE_CODE IN ('AGENT', 'SUPERVISOR')"); sqlStrBuilder.append(" ORDER BY UPPER(vu.FULL_NAME)");
sqlStrBuilder.append(" AND a.STATUS = 1");
sqlStrBuilder.append(" AND (b.CAMPAIGN_ID IS NULL OR b.CAMPAIGN_ID <> :p_campaign_id)");
sqlStrBuilder.append(" ORDER BY UPPER(a.FULL_NAME)");
SQLQuery query = session.createSQLQuery(sqlStrBuilder.toString()); SQLQuery query = session.createSQLQuery(sqlStrBuilder.toString());
...@@ -356,8 +363,7 @@ public class AgentsServiceImpl implements AgentsService { ...@@ -356,8 +363,7 @@ public class AgentsServiceImpl implements AgentsService {
query.addScalar("status", new ShortType()); query.addScalar("status", new ShortType());
query.addScalar("fullName", new StringType()); query.addScalar("fullName", new StringType());
query.addScalar("companySiteId", new LongType()); query.addScalar("companySiteId", new LongType());
query.addScalar("filterType", new ShortType()); query.addScalar("roleCode", new StringType());
query.addScalar("campaignAgentId", new LongType());
query.setResultTransformer(Transformers.aliasToBean(VSAUsersDTO.class)); query.setResultTransformer(Transformers.aliasToBean(VSAUsersDTO.class));
int count = 0; int count = 0;
...@@ -526,7 +532,7 @@ public class AgentsServiceImpl implements AgentsService { ...@@ -526,7 +532,7 @@ public class AgentsServiceImpl implements AgentsService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
......
...@@ -176,7 +176,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -176,7 +176,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
resultDTO.setDescription("CompleteCodeDTO null"); resultDTO.setDescription("CompleteCodeDTO null");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
...@@ -203,7 +203,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -203,7 +203,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
resultDTO.setDescription("CompleteCodeDTO null"); resultDTO.setDescription("CompleteCodeDTO null");
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
...@@ -227,7 +227,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -227,7 +227,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
...@@ -249,7 +249,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -249,7 +249,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR); resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return resultDTO; return resultDTO;
} }
......
...@@ -303,7 +303,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -303,7 +303,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setErrorCode(Constants.ApiErrorCode.SUCCESS); result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -475,7 +475,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -475,7 +475,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(rclResult); result.setData(rclResult);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -489,16 +489,8 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -489,16 +489,8 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
List<CampaignCustomer> lst = null;//campaignCustomerRepository.getCustomerRecallDate(dto.getCampaignId(), dto.getAgentId(), dto.getCompanySiteId(), ); List<CampaignCustomer> lst = null;//campaignCustomerRepository.getCustomerRecallDate(dto.getCampaignId(), dto.getAgentId(), dto.getCompanySiteId(), );
if (lst != null) { result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS); result.setDescription(Constants.ApiErrorDesc.ERROR);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
//result.setTotalRow(count);
//result.setListData(campaignExecuteRepository.searchCampaignExecute(requestDto, SQLBuilder.buildPageable(requestDto)));
//result.setData(data);
} else {
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR);
}
return result; return result;
} }
...@@ -537,7 +529,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -537,7 +529,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setErrorCode(Constants.ApiErrorCode.SUCCESS); result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -556,7 +548,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -556,7 +548,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(ccr); result.setData(ccr);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -577,7 +569,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -577,7 +569,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(ccr); result.setData(ccr);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -597,7 +589,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -597,7 +589,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(ccr); result.setData(ccr);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -623,7 +615,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -623,7 +615,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(resultUpdate); result.setData(resultUpdate);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR); result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR); result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
...@@ -725,7 +717,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -725,7 +717,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return lstTimeZone.getDialMode().toString(); return lstTimeZone.getDialMode().toString();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); // e.printStackTrace();
} }
return "-1"; return "-1";
......
...@@ -32,8 +32,8 @@ import java.util.*; ...@@ -32,8 +32,8 @@ import java.util.*;
public class CampaignServiceImpl implements CampaignService { public class CampaignServiceImpl implements CampaignService {
private static final Logger logger = LogManager.getLogger(CampaignServiceImpl.class); private static final Logger logger = LogManager.getLogger(CampaignServiceImpl.class);
public static String CAMPAIGN_TYPE = "CAMPAIGN_TYPE"; public static final String CAMPAIGN_TYPE = "CAMPAIGN_TYPE";
public static String CAMPAIGN_STATUS = "CAMPAIGN_STATUS"; public static final String CAMPAIGN_STATUS = "CAMPAIGN_STATUS";
@Autowired @Autowired
CampaignRepository campaignRepository; CampaignRepository campaignRepository;
...@@ -640,9 +640,15 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -640,9 +640,15 @@ public class CampaignServiceImpl implements CampaignService {
if (customerListDTO.getTotalCusAddRemove() > 0) { // Them khach hang if (customerListDTO.getTotalCusAddRemove() > 0) { // Them khach hang
// Lay ra danh sach khach hang phu hop de them // Lay ra danh sach khach hang phu hop de them
List<Customer> listCustomerToAdd = customerRepository.findAllCutomerNotInCampagin(customerListDTO.getCustomerListId(), campaignId); List<Customer> listCustomerToAdd = customerRepository.findAllCutomerNotInCampagin(customerListDTO.getCustomerListId(), campaignId);
int numOfCusInList = listCustomerToAdd.size(); // Số khách hàng còn lại của chiến dịch chưa đc add vào campaign int numOfCusInList = listCustomerToAdd.size(); // Số khách hàng còn lại của chiến dịch chưa đc add vào campaign hoặc đã add nhưng in_campaign_status = 0
for (int i = 0, j = 0; (i < customerListDTO.getTotalCusAddRemove() && j < numOfCusInList); j++) { for (int i = 0, j = 0; (i < customerListDTO.getTotalCusAddRemove() && j < numOfCusInList); j++) {
if (campaignCustomerRepository.findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(campaignId, companySiteId, listCustomerToAdd.get(j).getCustomerId()) != null) { // Khach hang đã đc chèn vào campaign theo individual CampaignCustomer tempEntity = campaignCustomerRepository.findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(campaignId, companySiteId, listCustomerToAdd.get(j).getCustomerId());
if (tempEntity != null) { // Khach hang đã đc chèn vào campaign theo individual / hoặc in_campaign_status = 0
if ((tempEntity.getCustomerListId() == customerListDTO.getCustomerListId()) && tempEntity.getInCampaignStatus() == 0) {
tempEntity.setInCampaignStatus((short) 1);
campaignCustomerRepository.save(tempEntity);
i+=1;
}
continue; continue;
} else { } else {
CampaignCustomer campaignCustomerEntity = new CampaignCustomer(); CampaignCustomer campaignCustomerEntity = new CampaignCustomer();
...@@ -676,6 +682,23 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -676,6 +682,23 @@ public class CampaignServiceImpl implements CampaignService {
return resultDTO; return resultDTO;
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getConnectStatus(Long companySiteId) {
ResultDTO resultDTO = new ResultDTO();
try {
List<ApParamDTO> list = campaignRepositoryCustom.getConnectStatus(companySiteId);
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;
}
// hungtt // hungtt
private Map<String, String> setMapData(Map<String, String> mapColumn, Locale locale) { private Map<String, String> setMapData(Map<String, String> mapColumn, Locale locale) {
mapColumn.put("CUSTOMER_ID", BundleUtils.getLangString("CUSTOMER_ID", locale)); mapColumn.put("CUSTOMER_ID", BundleUtils.getLangString("CUSTOMER_ID", locale));
......
...@@ -76,7 +76,7 @@ public class ScenarioAnswerServiceImpl implements ScenarioAnswerService { ...@@ -76,7 +76,7 @@ public class ScenarioAnswerServiceImpl implements ScenarioAnswerService {
Campaign campaign = campaignRepository.findByCampaignId(scenarioAnswerDTO.getCampaignId()); Campaign campaign = campaignRepository.findByCampaignId(scenarioAnswerDTO.getCampaignId());
if(campaign != null) { if(campaign != null) {
if (campaign.getStatus() == 0L || campaign.getStatus() == 1L) { if (campaign.getStatus() == 0L || campaign.getStatus() == 1L) {
scenarioAnswerRepository.deleteById(scenarioAnswerDTO.scenarioAnswerId); scenarioAnswerRepository.deleteById(scenarioAnswerDTO.getScenarioAnswerId());
campaignLog = new CampaignLog(); campaignLog = new CampaignLog();
campaignLog.setCompanySiteId(scenarioAnswerDTO.getCompanySiteId()); campaignLog.setCompanySiteId(scenarioAnswerDTO.getCompanySiteId());
campaignLog.setCreateTime(new Date()); campaignLog.setCreateTime(new Date());
......
package com.viettel.campaign.service.impl; package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify; import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.*; import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.repository.ccms_full.*; 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.ContactQuestResultRepository;
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.service.ScenarioQuestionService; import com.viettel.campaign.service.ScenarioQuestionService;
import com.viettel.campaign.service.ScenarioService; import com.viettel.campaign.service.ScenarioService;
import com.viettel.campaign.utils.BundleUtils; import com.viettel.campaign.utils.BundleUtils;
...@@ -10,7 +16,6 @@ import com.viettel.campaign.utils.Constants; ...@@ -10,7 +16,6 @@ import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.DataUtil; import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.utils.WorkBookBuilder; import com.viettel.campaign.utils.WorkBookBuilder;
import com.viettel.campaign.web.dto.*; import com.viettel.campaign.web.dto.*;
import com.viettel.econtact.filter.UserSession;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
...@@ -22,11 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -22,11 +27,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.*;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
...@@ -211,6 +215,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -211,6 +215,7 @@ public class ScenarioServiceImpl implements ScenarioService {
CellRangeAddressList typeCellRangeAddressList = new CellRangeAddressList(3, 9999, 1, 1); CellRangeAddressList typeCellRangeAddressList = new CellRangeAddressList(3, 9999, 1, 1);
DataValidation typeValidation = dataValidationHelper.createValidation(questionType, typeCellRangeAddressList); DataValidation typeValidation = dataValidationHelper.createValidation(questionType, typeCellRangeAddressList);
typeValidation.setSuppressDropDownArrow(true); typeValidation.setSuppressDropDownArrow(true);
typeValidation.setShowErrorBox(true);
sheet.addValidationData(typeValidation); sheet.addValidationData(typeValidation);
//HashInputCombobox //HashInputCombobox
...@@ -218,6 +223,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -218,6 +223,7 @@ public class ScenarioServiceImpl implements ScenarioService {
CellRangeAddressList hasInputCellRangeAddressList = new CellRangeAddressList(3, 9999, 4, 4); CellRangeAddressList hasInputCellRangeAddressList = new CellRangeAddressList(3, 9999, 4, 4);
DataValidation hasInputValidation = dataValidationHelper.createValidation(hasInput, hasInputCellRangeAddressList); DataValidation hasInputValidation = dataValidationHelper.createValidation(hasInput, hasInputCellRangeAddressList);
hasInputValidation.setSuppressDropDownArrow(true); hasInputValidation.setSuppressDropDownArrow(true);
hasInputValidation.setShowErrorBox(true);
sheet.addValidationData(hasInputValidation); sheet.addValidationData(hasInputValidation);
//Required //Required
...@@ -225,6 +231,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -225,6 +231,7 @@ public class ScenarioServiceImpl implements ScenarioService {
CellRangeAddressList requiredCellRangeAddressList = new CellRangeAddressList(3, 9999, 5, 5); CellRangeAddressList requiredCellRangeAddressList = new CellRangeAddressList(3, 9999, 5, 5);
DataValidation requiredValidation = dataValidationHelper.createValidation(required, requiredCellRangeAddressList); DataValidation requiredValidation = dataValidationHelper.createValidation(required, requiredCellRangeAddressList);
requiredValidation.setSuppressDropDownArrow(true); requiredValidation.setSuppressDropDownArrow(true);
requiredValidation.setShowErrorBox(true);
sheet.addValidationData(requiredValidation); sheet.addValidationData(requiredValidation);
//Required //Required
...@@ -232,6 +239,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -232,6 +239,7 @@ public class ScenarioServiceImpl implements ScenarioService {
CellRangeAddressList defaultValueCellRangeAddressList = new CellRangeAddressList(3, 9999, 6, 6); CellRangeAddressList defaultValueCellRangeAddressList = new CellRangeAddressList(3, 9999, 6, 6);
DataValidation defaultValueValidation = dataValidationHelper.createValidation(defaultValue, defaultValueCellRangeAddressList); DataValidation defaultValueValidation = dataValidationHelper.createValidation(defaultValue, defaultValueCellRangeAddressList);
defaultValueValidation.setSuppressDropDownArrow(true); defaultValueValidation.setSuppressDropDownArrow(true);
defaultValueValidation.setShowErrorBox(true);
sheet.addValidationData(defaultValueValidation); sheet.addValidationData(defaultValueValidation);
...@@ -240,7 +248,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -240,7 +248,7 @@ public class ScenarioServiceImpl implements ScenarioService {
logger.error(e.getMessage()); logger.error(e.getMessage());
return null; return null;
}finally { }finally {
if (workbook != null) workbook.close(); //if (workbook != null) workbook.close();
} }
} }
...@@ -253,6 +261,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -253,6 +261,7 @@ public class ScenarioServiceImpl implements ScenarioService {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
boolean isValid = true; boolean isValid = true;
XSSFWorkbook workbook = null; XSSFWorkbook workbook = null;
FileInputStream fis = null;
try { try {
List<String> fileHeaderList = new ArrayList<>(); List<String> fileHeaderList = new ArrayList<>();
fileHeaderList.add(BundleUtils.getLangString("scenario.template.questionCode", locale)); fileHeaderList.add(BundleUtils.getLangString("scenario.template.questionCode", locale));
...@@ -265,7 +274,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -265,7 +274,7 @@ public class ScenarioServiceImpl implements ScenarioService {
fileHeaderList.add(BundleUtils.getLangString("scenario.template.mappingQuestion", locale)); fileHeaderList.add(BundleUtils.getLangString("scenario.template.mappingQuestion", locale));
File file = new File(path); File file = new File(path);
FileInputStream fis = new FileInputStream(file); fis = new FileInputStream(file);
workbook = new XSSFWorkbook(fis); workbook = new XSSFWorkbook(fis);
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
...@@ -419,7 +428,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -419,7 +428,7 @@ public class ScenarioServiceImpl implements ScenarioService {
if (item.getMappingQuestionCode() != null && item.getMappingQuestionId() == null) { if (item.getMappingQuestionCode() != null && item.getMappingQuestionId() == null) {
ScenarioQuestion question = questionRepository.findScenarioQuestionByCodeAndCompanySiteId(item.getMappingQuestionCode(), item.getCompanySiteId()); ScenarioQuestion question = questionRepository.findScenarioQuestionByCodeAndCompanySiteId(item.getMappingQuestionCode(), item.getCompanySiteId());
if (question != null) { if (question != null) {
ScenarioAnswer answerForUpdate = answerRepository.findScenarioAnswerByCode(item.code); ScenarioAnswer answerForUpdate = answerRepository.findScenarioAnswerByCode(item.getCode());
if(answerForUpdate != null) { if(answerForUpdate != null) {
answerForUpdate.setMappingQuestionId(question.getScenarioQuestionId()); answerForUpdate.setMappingQuestionId(question.getScenarioQuestionId());
answerRepository.save(answerForUpdate); answerRepository.save(answerForUpdate);
...@@ -447,6 +456,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -447,6 +456,7 @@ public class ScenarioServiceImpl implements ScenarioService {
result.put("message", BundleUtils.getLangString("customer.errorValidate", locale)); result.put("message", BundleUtils.getLangString("customer.errorValidate", locale));
}finally { }finally {
if (workbook != null) workbook.close(); if (workbook != null) workbook.close();
if(fis != null) fis.close();
} }
return result; return result;
} }
......
...@@ -114,7 +114,7 @@ public final class DateTimeUtil { ...@@ -114,7 +114,7 @@ public final class DateTimeUtil {
try { try {
expression = new CronExpression(cron); expression = new CronExpression(cron);
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); // e.printStackTrace();
} }
Date currentDate = new Date(); Date currentDate = new Date();
assert expression != null; assert expression != null;
......
...@@ -2,19 +2,19 @@ package com.viettel.campaign.utils; ...@@ -2,19 +2,19 @@ package com.viettel.campaign.utils;
public enum SearchOperation { public enum SearchOperation {
EQUALITY, NEGATION, GREATER_THAN, LESS_THAN, LIKE, STARTS_WITH, ENDS_WITH, CONTAINS; EQUALITY, NEGATION, GREATER_THAN, LESS_THAN, LIKE, STARTS_WITH, ENDS_WITH, CONTAINS;
public static final String[] SIMPLE_OPERATION_SET = { ":", "!", ">", "<", "~" }; protected static final String[] SIMPLE_OPERATION_SET = { ":", "!", ">", "<", "~" };
public static final String OR_PREDICATE_FLAG = "'"; protected static final String OR_PREDICATE_FLAG = "'";
public static final String ZERO_OR_MORE_REGEX = "*"; protected static final String ZERO_OR_MORE_REGEX = "*";
public static final String OR_OPERATOR = "OR"; protected static final String OR_OPERATOR = "OR";
public static final String AND_OPERATOR = "AND"; protected static final String AND_OPERATOR = "AND";
public static final String LEFT_PARANTHESIS = "("; protected static final String LEFT_PARANTHESIS = "(";
public static final String RIGHT_PARANTHESIS = ")"; protected static final String RIGHT_PARANTHESIS = ")";
public static SearchOperation getSimpleOperation(final char input) { public static SearchOperation getSimpleOperation(final char input) {
switch (input) { switch (input) {
......
...@@ -13,18 +13,18 @@ import java.util.Date; ...@@ -13,18 +13,18 @@ import java.util.Date;
@Getter @Getter
@Setter @Setter
public class ScenarioAnswerDTO implements Serializable { public class ScenarioAnswerDTO implements Serializable {
public Long scenarioAnswerId; private Long scenarioAnswerId;
public Long companySiteId; private Long companySiteId;
public Long scenarioQuestionId; private Long scenarioQuestionId;
public String code; private String code;
public String answer; private String answer;
public Integer orderIndex; private Integer orderIndex;
public Short hasInput; private Short hasInput;
public Short status; private Short status;
public Date createTime; private Date createTime;
public Date deleteTime; private Date deleteTime;
public Long mappingQuestionId; private Long mappingQuestionId;
public Long campaignId; private Long campaignId;
public String importQuestionCode; private String importQuestionCode;
public String mappingQuestionCode; private String mappingQuestionCode;
} }
...@@ -56,4 +56,6 @@ public class CampaignRequestDTO extends BaseDTO { ...@@ -56,4 +56,6 @@ public class CampaignRequestDTO extends BaseDTO {
List<FieldsToShowDTO> lstFiedCustomer; List<FieldsToShowDTO> lstFiedCustomer;
List<CustomerListDTO> lstCustomerCampaign; List<CustomerListDTO> lstCustomerCampaign;
String customerListId; String customerListId;
String statuses;
String channels;
} }
...@@ -2,15 +2,10 @@ package com.viettel.campaign.web.rest; ...@@ -2,15 +2,10 @@ package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.TimeRangeDialMode; import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode; import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.service.CampaignService; import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.utils.BundleUtils; import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.utils.Constants; import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO; import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import com.viettel.econtact.filter.UserSession;
import org.apache.commons.io.FilenameUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -20,16 +15,12 @@ import org.springframework.http.HttpStatus; ...@@ -20,16 +15,12 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Objects;
@RestController @RestController
@RequestMapping("/ipcc/campaign") @RequestMapping("/ipcc/campaign")
...@@ -227,4 +218,11 @@ public class CampaignController { ...@@ -227,4 +218,11 @@ public class CampaignController {
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@GetMapping("/getConnectStatus")
@ResponseBody
public ResponseEntity<ResultDTO> getConnectStatus(@RequestParam("companySiteId") Long companySiteId) {
ResultDTO resultDTO = campaignService.getConnectStatus(companySiteId);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
} }
...@@ -6,7 +6,6 @@ import com.viettel.campaign.model.ccms_full.CustomizeFields; ...@@ -6,7 +6,6 @@ import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.repository.ccms_full.CustomerQueryRepository; import com.viettel.campaign.repository.ccms_full.CustomerQueryRepository;
import com.viettel.campaign.service.CustomerService; import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.utils.Config; import com.viettel.campaign.utils.Config;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.RedisUtil; import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*; import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO; import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
...@@ -33,7 +32,6 @@ import java.text.SimpleDateFormat; ...@@ -33,7 +32,6 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
@Controller @Controller
@RequestMapping("/ipcc/customer") @RequestMapping("/ipcc/customer")
...@@ -202,9 +200,9 @@ public class CustomerController { ...@@ -202,9 +200,9 @@ public class CustomerController {
if (file.isEmpty()) { if (file.isEmpty()) {
return new ResponseEntity<>("file-empty", HttpStatus.OK); return new ResponseEntity<>("file-empty", HttpStatus.OK);
} }
if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) { // if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
return new ResponseEntity<>("template-invalid", HttpStatus.OK); // return new ResponseEntity<>("template-invalid", HttpStatus.OK);
} // }
String path = saveUploadFile(file); String path = saveUploadFile(file);
List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId()); List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, Long.parseLong(customerListId)); Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, Long.parseLong(customerListId));
......
...@@ -39,7 +39,7 @@ public class ScenarioAnswerController { ...@@ -39,7 +39,7 @@ public class ScenarioAnswerController {
} }
@RequestMapping(value = "/count-duplicate-code", method = RequestMethod.GET) @RequestMapping(value = "/count-duplicate-code", method = RequestMethod.GET)
ResponseEntity<Integer> countDuplicateCode(@RequestParam String code, @RequestParam Long scenarioQuestionId, @RequestParam Long scenarioAnswerId) { public ResponseEntity<Integer> countDuplicateCode(@RequestParam String code, @RequestParam Long scenarioQuestionId, @RequestParam Long scenarioAnswerId) {
Integer count = scenarioAnswerService.countDuplicateScenarioCode(code, scenarioQuestionId, scenarioAnswerId); Integer count = scenarioAnswerService.countDuplicateScenarioCode(code, scenarioQuestionId, scenarioAnswerId);
return new ResponseEntity<>(count, HttpStatus.OK); return new ResponseEntity<>(count, HttpStatus.OK);
} }
......
...@@ -8,7 +8,6 @@ import com.viettel.campaign.utils.RedisUtil; ...@@ -8,7 +8,6 @@ import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.ContactQuestResultDTO; import com.viettel.campaign.web.dto.ContactQuestResultDTO;
import com.viettel.campaign.web.dto.ResultDTO; import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioDTO; import com.viettel.campaign.web.dto.ScenarioDTO;
import com.viettel.campaign.web.dto.request_dto.RequestImportDTO;
import com.viettel.econtact.filter.UserSession; import com.viettel.econtact.filter.UserSession;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
...@@ -46,30 +45,30 @@ public class ScenarioController { ...@@ -46,30 +45,30 @@ public class ScenarioController {
ScenarioService scenarioService; ScenarioService scenarioService;
@RequestMapping(value = "/findOneByCampaignIdAndCompanyId", method = RequestMethod.GET) @RequestMapping(value = "/findOneByCampaignIdAndCompanyId", method = RequestMethod.GET)
Scenario findOneByCampaignIdAndCompanyId(@RequestParam Long campaignId, @RequestParam Long companySiteId) { public Scenario findOneByCampaignIdAndCompanyId(@RequestParam Long campaignId, @RequestParam Long companySiteId) {
return scenarioService.findScenarioByCampaignIdAndCompanySiteId(campaignId, companySiteId); return scenarioService.findScenarioByCampaignIdAndCompanySiteId(campaignId, companySiteId);
} }
@RequestMapping(method = RequestMethod.PUT) @RequestMapping(method = RequestMethod.PUT)
ResponseEntity<ResultDTO> update(@RequestBody ScenarioDTO scenario) { public ResponseEntity<ResultDTO> update(@RequestBody ScenarioDTO scenario) {
ResultDTO resultDTO = scenarioService.update(scenario); ResultDTO resultDTO = scenarioService.update(scenario);
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
@RequestMapping(value = "/sort-question-answer", method = RequestMethod.POST) @RequestMapping(value = "/sort-question-answer", method = RequestMethod.POST)
ResponseEntity<ResultDTO> sortQuestionAndAnswer(@RequestBody ScenarioDTO scenarioDTO) { public ResponseEntity<ResultDTO> sortQuestionAndAnswer(@RequestBody ScenarioDTO scenarioDTO) {
ResultDTO resultDTO = scenarioService.sortQuestionAndAnswer(scenarioDTO); ResultDTO resultDTO = scenarioService.sortQuestionAndAnswer(scenarioDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
@RequestMapping(value = "/count-duplicate-code", method = RequestMethod.GET) @RequestMapping(value = "/count-duplicate-code", method = RequestMethod.GET)
ResponseEntity<Integer> countDuplicateCode(@RequestParam String code, @RequestParam Long scenarioId, @RequestParam Long companySiteId) { public ResponseEntity<Integer> countDuplicateCode(@RequestParam String code, @RequestParam Long scenarioId, @RequestParam Long companySiteId) {
Integer count = scenarioService.countDuplicateScenarioCode(companySiteId, code, scenarioId); Integer count = scenarioService.countDuplicateScenarioCode(companySiteId, code, scenarioId);
return new ResponseEntity<>(count, HttpStatus.OK); return new ResponseEntity<>(count, HttpStatus.OK);
} }
@RequestMapping(value = "/saveContactQuestResult", method = RequestMethod.POST) @RequestMapping(value = "/saveContactQuestResult", method = RequestMethod.POST)
ResponseEntity<ResultDTO> saveContactQuestResult(@RequestBody ContactQuestResultDTO dto) { public ResponseEntity<ResultDTO> saveContactQuestResult(@RequestBody ContactQuestResultDTO dto) {
ResultDTO resultDTO = scenarioService.saveContacQuestResult(dto); ResultDTO resultDTO = scenarioService.saveContacQuestResult(dto);
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
......
...@@ -90,7 +90,6 @@ customer.not = No ...@@ -90,7 +90,6 @@ customer.not = No
customer.noData = Template empty customer.noData = Template empty
customer.nameRequired = Full name required; customer.nameRequired = Full name required;
customer.emailMax50 = Email must less than 50 character; 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.importSuccess = Import Successful
customer.importFailed = Import Failed customer.importFailed = Import Failed
customer.errorValidate = Error while validating customer.errorValidate = Error while validating
......
...@@ -92,7 +92,9 @@ customer.not = Không ...@@ -92,7 +92,9 @@ customer.not = Không
customer.noData = Template không có dữ liệu customer.noData = Template không có dữ liệu
customer.nameRequired = Họ và tên không được để trống; customer.nameRequired = Họ và tên không được để trống;
customer.emailMax50 = Email không được quá 50 kí tự; 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.mainPhoneRequired=Số điện thoại chính không được để trống
customer.secondPhoneRequired=Số điện thoại phụ không được để trống
customer.emailRequired=Số điện thoại email không được để trống
customer.importSuccess = Import dữ liệu thành công customer.importSuccess = Import dữ liệu thành công
customer.importFailed = Import dữ liệu thất bại customer.importFailed = Import dữ liệu thất bại
customer.errorValidate = Validate dữ liệu lỗi customer.errorValidate = Validate dữ liệu lỗi
......
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