Commit f34fc537 authored by Nguyen Ha's avatar Nguyen Ha

Merge remote-tracking branch 'origin/master'

parents 8b0b0e1e 8d568808
......@@ -123,7 +123,7 @@ public class CampaignJob {
List<CustomerTime> customerTimes = customerTimeService.findByCustomerId(customer.getCustomerId());
customerTimes.parallelStream().forEach(customerTime -> {
log.info("Cap nhat Customer time cua KH ... #{}", customerTime.getCustomerId());
customerTime.setStatus(2);
customerTime.setStatus((short) 2);
customerTime.setUpdateTime(new Date());
customerTimeService.update(customerTime);
});
......
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "AGENT_STATUS_STAT")
@Getter
@Setter
public class AgentStatusStat {
@Id
@NotNull
@GeneratedValue(generator = "AGENT_STATUS_STAT_SEQ")
@SequenceGenerator(name = "AGENT_STATUS_STAT_SEQ", sequenceName = "AGENT_STATUS_STAT_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "KZ_ACCOUNT_ID")
@NotNull
private String kzAccountId;
@Column(name = "KZ_USER_ID")
@NotNull
private String kzUserId;
@Column(name = "CURRENT_STATUS")
@NotNull
private String currentStatus;
@Column(name = "TIMESTAMP")
@NotNull
private String timestamp;
@Column(name = "PREVIOUS_STATUS")
private String previousStatus;
@Column(name = "PREVIOUS_STATUS_DURATION")
private Long previousStatusDuration;
@Column(name = "ID")
@NotNull
private Long id;
@Column(name = "CHANNEL")
@NotNull
private String channel;
}
......@@ -19,15 +19,18 @@ import java.util.Date;
public class CustomerTime {
@Id
@GeneratedValue(generator = "CUSTOMER_TIME_SEQ")
@SequenceGenerator(name = "CUSTOMER_TIME_SEQ", sequenceName = "CUSTOMER_TIME_SEQ", allocationSize = 1)
@Basic(optional = false)
@NotNull
@Column(name = "CUSTOMER_TIME_ID")
private Long customerTimeId;
@Column(name = "COMPANY_SITE_ID")
private String companySiteId;
private Long companySiteId;
@Column(name = "CUSTOMER_ID")
private String customerId;
private Long customerId;
@Column(name = "START_TIME")
private Date startTime;
......@@ -36,7 +39,7 @@ public class CustomerTime {
private Date endTime;
@Column(name = "STATUS")
private Integer status;
private Short status;
@Column(name = "CREATE_TIME")
private Date createTime;
......@@ -45,10 +48,10 @@ public class CustomerTime {
private Date updateTime;
@Column(name = "CREATE_BY")
private String createBy;
private Long createBy;
@Column(name = "UPDATE_BY")
private String updateBy;
private Long updateBy;
@Column(name = "CONTACT_CUST_RESULT_ID")
private Long contactCustResultId;
......
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.AgentStatusStat;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface AgentStatusStatRepository extends JpaRepository<AgentStatusStat, Long> {
AgentStatusStat findByKzUserIdAndCurrentStatusNotIn(String kzUserId, List<String> currentStatus);
}
......@@ -18,7 +18,9 @@ public interface CampaignAgentRepository extends JpaRepository<CampaignAgent, Lo
@Query(value = "SELECT campaign_agent_seq.nextval FROM DUAL", nativeQuery = true)
Long getNextSeqId();
List<CampaignAgent> findByCampaignIdAndAgentId(Long campaignId, Long agentId);
CampaignAgent findByCampaignIdAndAgentId(Long campaignId, Long agentId);
List<CampaignAgent> findByAgentId(Long agentId);
@Modifying
@Query("delete from CampaignAgent c where c.campaignAgentId in (:p_campaign_agent_id)")
......
......@@ -13,6 +13,8 @@ import java.util.List;
@Repository
public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long> {
@Query("select c from CampaignCfg c where c.campaignCompleteCodeId in (:p_ids) and c.companySiteId=:p_company_site_id and c.status = 1")
List<CampaignCfg> findAllCampaignCfg(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
@Query("FROM CampaignCfg u WHERE u.status = 1 AND u.completeValue NOT IN (1,2,3,4)")
Page<CampaignCfg> findAll(Pageable pageable);
......@@ -46,4 +48,7 @@ public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long>
@Query("select c from CampaignCfg c where c.companySiteId =:p_company_site_id")
List<CampaignCfg> findAllCampaignCompleteCode();
@Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue = :completeValue AND companySiteId = :companySiteId")
CampaignCfg findByCompanySiteIdAndCompleteValue(@Param("companySiteId") Long companySiteId, @Param("completeValue") String completeValue);
}
......@@ -14,6 +14,14 @@ import java.util.List;
@Transactional(DataSourceQualify.CCMS_FULL)
public interface CampaignCustomerRepository extends JpaRepository<CampaignCustomer, Long>, CampaignCustomerRepositoryCustom {
CampaignCustomer findCampaignCustomerByCampaignCustomerId(Long id);
CampaignCustomer findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(Long campaignId, Long companySiteId, Long customerId);
List<CampaignCustomer> findCampaignCustomersByCampaignIdAndCompanySiteIdAndCustomerIdAndInCampaignStatus(Long campaignId, Long companySiteId, Long customerId, Short inCampaingStatus);
CampaignCustomer findCampaignCustomersByCampaignIdAndCustomerId(Long campaignId, Long customerId);
@Query(value = "SELECT COUNT(*) " +
" FROM CAMPAIGN_CUSTOMER CC " +
" JOIN CAMPAIGN C ON CC.CAMPAIGN_ID = C.CAMPAIGN_ID " +
......@@ -34,10 +42,6 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
"AND CCC.STATUS = 1 ", nativeQuery = true)
Long getCustomerRecall(@Param("campaignId") Long campaignId, @Param("customerId") Long customerId);
CampaignCustomer findCampaignCustomerByCampaignCustomerId(Long id);
@Query(value = "select C.NAME, " +
"C.EMAIL, " +
"C.PLACE_OF_BIRTH, " +
......@@ -57,10 +61,6 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
, nativeQuery = true)
Long searchCustomer(@Param("site_id") Long pSiteId);
@Query(value = "SELECT * FROM CAMPAIGN_CUSTOMER CC " +
"WHERE CC.STATUS = 0 " +
"AND CC.CAMPAIGN_ID = :campaignId " +
......@@ -69,7 +69,7 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
List<CampaignCustomer> findCustomerNoContact(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId, @Param("customerListId") Long customerListId);
@Query(value = "SELECT * FROM CAMPAIGN_CUSTOMER CC " +
"WHERE CC.STATUS IN (SELECT COMPLETE_VALUE from CAMPAIGN_COMPLETE_CODE where STATUS = 1 and IS_FINISH = 0 and IS_RECALL = 0)" +
"WHERE CC.STATUS IN (SELECT COMPLETE_VALUE from CAMPAIGN_COMPLETE_CODE where STATUS = 1 and COMPLETE_TYPE=1)" +
"AND CC.CAMPAIGN_ID = :campaignId " +
"AND CC.COMPANY_SITE_ID = :companySiteId " +
"AND CC.CUSTOMER_LIST_ID = :customerListId", nativeQuery = true)
......@@ -78,9 +78,8 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
@Query(value = "with status_customer as (\n" +
"select complete_value \n" +
"from campaign_complete_code\n" +
"where complete_value <> 4\n" +
" and is_finish <> 1\n" +
" and campaign_type = 1\n" +
"where status = 1\n" +
" and complete_type = 1\n" +
" and company_site_id = :p_company_site_id\n" +
")\n" +
"select * from campaign_customer\n" +
......@@ -89,10 +88,6 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
" and (status = 0 or status in (select * from status_customer))", nativeQuery = true)
List<CampaignCustomer> findListCustomerToDel(@Param("p_company_site_id") Long companySiteId, @Param("p_campaign_id") Long campaignId, @Param("p_cus_list_id") Long customerListId);
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 complete_type = 1", nativeQuery = true)
List<Short> getStatus();
}
......@@ -21,4 +21,5 @@ public interface CampaignExecuteRepository {
List<ContactCustResultDTO> getInteractiveResult(CampaignRequestDTO dto, Pageable pageable);
List<ContactCustResultDTO> getExcelInteractiveResult(CampaignRequestDTO dto);
}
......@@ -37,6 +37,8 @@ public interface CampaignRepositoryCustom {
ResultDTO getCustomerListInformation(CampaignRequestDTO dto);
ResultDTO getCountIndividualOnList(CampaignRequestDTO dto);
List<ApParamDTO> getConnectStatus(Long companySiteId);
//</editor-fold>
}
......@@ -2,8 +2,15 @@ package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ContactCustResult;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.sql.Date;
@Repository
public interface ContactCustResultRepository extends JpaRepository<ContactCustResult, Long> {
@Query(value = "SELECT MAX(createTime) FROM ContactCustResult WHERE campaignId = :campaignId AND agentId = :agentId AND status = 1")
Date getMaxCreateTime(@Param("campaignId") Long campaignId, @Param("agentId") Long agentId);
}
......@@ -12,5 +12,10 @@ import java.util.List;
@Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface ContactQuestResultRepository extends JpaRepository<ContactQuestResult, Long> {
List<ContactQuestResultDTO> findByCompanySiteIdAndCampaignId(Long companySiteId, Long campaignId);
List<ContactQuestResult> findByContactCustResultId(Long contactCustResultId);
List<ContactQuestResult> findByCompanySiteIdAndCampaignIdAndCustomerId(Long companySiteId, Long campaignId, Long customerId);
}
......@@ -11,6 +11,8 @@ import java.util.List;
public interface CustomerListMappingRepository extends JpaRepository<CustomerListMapping, Long> {
// ----------- customer ------------ //
@Query("select c from CustomerListMapping c where c.customerId in (:p_ids) and c.customerListId =:p_customer_list_id and c.companySiteId=:p_company_site_id")
List<CustomerListMapping> findAllCustomerListMapping(@Param("p_ids") List<Long> p_ids, @Param("p_customer_list_id") Long p_customer_list_id, @Param("p_company_site_id") Long p_company_site_id);
@Modifying
@Query("delete from CustomerListMapping c where c.customerId=:p_customer_id and c.customerListId=:p_customer_list_id and c.companySiteId=:p_company_site_id")
......
......@@ -21,13 +21,13 @@ public interface TimeRangeDialModeRepository extends JpaRepository<TimeRangeDial
List<TimeRangeDialMode> findTimeRangeDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT * " +
"FROM (SELECT Z.* " +
" FROM TIME_ZONE_DIAL_MODE Z INNER JOIN CAMPAIGN C ON Z.CAMPAIGN_ID = C.CAMPAIGN_ID " +
" WHERE Z.COMPANY_SITE_ID = :companySiteId " +
" AND Z.CAMPAIGN_ID = :campaignId " +
" AND TO_DATE(START_TIME, 'YYYY/MM/DD') <= TO_DATE(SYSDATE, 'YYYY/MM/DD') " +
" AND TO_DATE((to_char(SYSDATE, 'YYYY/MM/DD') || ' ' || Z.HOUR || ':' || Z.MINUTE || ':00'), 'YYYY/MM/DD HH24:MI:SS') <= SYSDATE " +
" ORDER BY TO_DATE((to_char(SYSDATE, 'YYYY/MM/DD') || ' ' || Z.HOUR || ':' || Z.MINUTE || ':00'), 'YYYY/MM/DD HH24:MI:SS') DESC " +
"FROM (SELECT R.* " +
" FROM TIME_RANGE_DIAL_MODE R INNER JOIN CAMPAIGN C ON R.CAMPAIGN_ID = C.CAMPAIGN_ID" +
" WHERE R.COMPANY_SITE_ID = :companySiteId " +
" AND R.CAMPAIGN_ID = :campaignId " +
" AND C.START_TIME <= SYSDATE " +
" AND R.START_TIME <= SYSDATE " +
" ORDER BY R.START_TIME DESC " +
" ) WHERE ROWNUM = 1", nativeQuery = true)
TimeRangeDialMode findDialModeAtCurrent(@Param("companySiteId") Long companySiteId, @Param("campaignId") Long campaignId);
......
......@@ -21,14 +21,15 @@ public interface TimeZoneDialModeRepository extends JpaRepository<TimeZoneDialMo
List<TimeZoneDialMode> findTimeZoneDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT * " +
"FROM (SELECT R.* " +
" FROM TIME_RANGE_DIAL_MODE R " +
" WHERE R.CAMPAIGN_ID = 11 " +
" AND R.COMPANY_SITE_ID = 662691 " +
" AND TO_DATE(R.START_TIME, 'YYYY/MM/DD HH24:MI:SS') <= TO_DATE(SYSDATE, 'YYYY/MM/DD HH24:MI:SS') " +
" ORDER BY R.START_TIME DESC " +
"FROM (SELECT Z.* " +
" FROM TIME_ZONE_DIAL_MODE Z INNER JOIN CAMPAIGN C ON Z.CAMPAIGN_ID = C.CAMPAIGN_ID " +
" WHERE Z.COMPANY_SITE_ID = :companySiteId " +
" AND Z.CAMPAIGN_ID = :campaignId " +
" AND TO_CHAR(C.START_TIME, 'YYYY/MM/DD') <= TO_CHAR(SYSDATE, 'YYYY/MM/DD') " +
" AND TO_DATE((TO_CHAR(SYSDATE, 'YYYY/MM/DD') || ' ' || Z.HOUR || ':' || Z.MINUTE || ':00'), 'YYYY/MM/DD HH24:MI:SS') <= SYSDATE " +
" ORDER BY TO_DATE((TO_CHAR(SYSDATE, 'YYYY/MM/DD') || ' ' || Z.HOUR || ':' || Z.MINUTE || ':00'), 'YYYY/MM/DD HH24:MI:SS') DESC " +
" ) WHERE ROWNUM = 1", nativeQuery = true)
TimeZoneDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
TimeZoneDialMode findDialModeAtCurrent(@Param("companySiteId") Long companySiteId, @Param("campaignId") Long campaignId);
void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
}
......@@ -6,5 +6,8 @@ import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface VSAUsersRepository extends JpaRepository<VSAUsers, Long> {
List<VSAUsers> findAllByCompanySiteId(Long companySiteId);
VSAUsers findByUserId(Long userId);
}
......@@ -2,15 +2,13 @@ package com.viettel.campaign.repository.ccms_full.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.repository.ccms_full.CampaignExecuteRepository;
import com.viettel.campaign.repository.ccms_full.ContactQuestResultRepository;
import com.viettel.campaign.repository.ccms_full.TimeRangeDialModeRepository;
import com.viettel.campaign.repository.ccms_full.TimeZoneDialModeRepository;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.DataUtil;
import com.viettel.campaign.utils.HibernateUtil;
import com.viettel.campaign.web.dto.ApParamDTO;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ContactCustResultDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
......@@ -57,6 +55,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
@Autowired
TimeRangeDialModeRepository rangeDialModeRepository;
@Autowired
ContactQuestResultRepository contactQuestResultRepository;
@Override
public List<ApParamDTO> getComboBoxStatus(String companySiteId, String completeType) {
List<ApParamDTO> list = new ArrayList<>();
......@@ -122,7 +123,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
sql.append(" CCR.PHONE_NUMBER AS phoneNumber, ");
sql.append(" CUS.NAME AS customerName, ");
sql.append(" CCR.START_CALL AS startCall, ");
sql.append(" CC1.COMPLETE_NAME AS contactStatus, ");
sql.append(" CC1.COMPLETE_NAME AS connectStatus, ");
sql.append(" CC2.COMPLETE_NAME AS surveyStatus, ");
sql.append(" C.STATUS AS status, ");
sql.append(" CCR.STATUS AS recordStatus, ");
......@@ -290,7 +291,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
item.setPhoneNumber((String) obj[5]);
item.setCustomerName((String) obj[6]);
item.setStartCall(obj[7] == null ? null : (Date) obj[7]);
item.setContactStatus((String) obj[8]);
item.setConnectStatus((String) obj[8]);
item.setSurveyStatus((String) obj[9]);
item.setStatus(obj[10] == null ? 0 : ((BigDecimal) obj[10]).shortValueExact());
item.setRecordStatus(obj[11] == null ? 0 : ((BigDecimal) obj[11]).shortValueExact());
......@@ -459,6 +460,9 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
@Transactional(DataSourceQualify.CCMS_FULL)
public List<CampaignDTO> searchCampaignExecute(CampaignRequestDTO campaignRequestDto, Pageable pageable) {
List<CampaignDTO> result = new ArrayList<>();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = null;
StringBuilder expression = new StringBuilder()
.append(" SELECT C.CAMPAIGN_CODE, C.CAMPAIGN_NAME, C.CONTENT, C.START_TIME, C.END_TIME, C.STATUS, CA.STATUS AS AGENT_STATUS, C.CAMPAIGN_ID ")
.append(" FROM CAMPAIGN C INNER JOIN CAMPAIGN_AGENT CA ON C.CAMPAIGN_ID = CA.CAMPAIGN_ID ")
......@@ -505,12 +509,15 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
}
try {
Query query = entityManager.createNativeQuery(expression.toString());
session = sessionFactory.openSession();
session.beginTransaction();
SQLQuery query = session.createSQLQuery(expression.toString());
query.setParameter("pAgentId", Long.parseLong(campaignRequestDto.getAgentId()));
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode())) {
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode()) && !DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignCode().trim())) {
String[] lstCode = campaignRequestDto.getCampaignCode().split(",");
query.setParameter("pCampaignCode", lstCode);
query.setParameterList("pCampaignCode", lstCode);
}
if (!DataUtil.isNullOrEmpty(campaignRequestDto.getCampaignName())) {
......@@ -556,9 +563,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
query.setMaxResults(pageable.getPageSize());
}
List<Object[]> data = query.getResultList();
//TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(campaignRequestDto.getCampaignId()), Long.parseLong(campaignRequestDto.getCompanySiteId()));
//TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(campaignRequestDto.getCampaignId()), Long.parseLong(campaignRequestDto.getCompanySiteId()));
List<Object[]> data = query.list();
for (Object[] obj : data) {
CampaignDTO item = new CampaignDTO();
......@@ -579,7 +584,11 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
return result;
} catch (Exception e) {
// e.printStackTrace();
e.printStackTrace();
} finally {
if (null != session) {
session.close();
}
}
return result;
......
......@@ -22,4 +22,6 @@ public interface AgentsService {
ResultDTO searchCampaignAgentSelectByName(int page, int pageSize, Long companySiteId, Long campaignId, String userName, String fullName);
ResultDTO createMultipleCampaignAgent(CampaignAgentRequestDTO campaignAgentRequestDTO);
ResultDTO updateAgent(CampaignAgentDTO campaignAgentDTO);
}
......@@ -12,7 +12,7 @@ public interface CampaignCfgService {
Map listCompleteCodeByName(int page, int pageSize, String sort, String name);
ResultDTO createCompleteCode(CampaignCfgDTO completeCodeDTO);
ResultDTO createCompleteCode(CampaignCfgDTO completeCodeDTO, Long userId);
ResultDTO updateCompleteCode(CampaignCfgDTO completeCodeDTO);
......
......@@ -10,7 +10,6 @@ import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
@Service
public interface CampaignExecuteService {
//<editor-fold: hungtt>
ResultDTO getComboBoxStatus(String companySiteId, String completeType);
......@@ -21,7 +20,9 @@ public interface CampaignExecuteService {
XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException;
ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto, String xAuthToken);
ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto);
ResultDTO checkExecuteCampaign(CampaignRequestDTO requestDto);
ResultDTO getExecuteCampaign(CampaignRequestDTO requestDto);
......@@ -33,11 +34,13 @@ public interface CampaignExecuteService {
ResultDTO getCallLog(ReceiveCustLogDTO dto);
ResultDTO getCallStatus(CampaignRequestDTO dto);
ResultDTO getAgentLogout(CampaignRequestDTO dto);
ResultDTO callCustomer(ContactCustResultDTO dto, UserSession userSession);
ResultDTO getLogoutContactResult(ReceiveCustLogDTO dto);
ResultDTO updateContactCustResult(ContactCustResultDTO dto, UserSession userSession);
ResultDTO draftAtTen(ContactCustResultDTO dto, UserSession userSession);
ResultDTO recallCustomer(ContactCustResultDTO dto);
......@@ -49,9 +52,15 @@ public interface CampaignExecuteService {
ResultDTO getCustomerInfor(Long companySiteId, Long customerId, Long campaignId);
ResultDTO createListContacQuestResult(List<ContactQuestResultDTO> dtoList);
ResultDTO createListContactQuestResult(List<ContactQuestResultDTO> dtoList);
String getDialModeAtCurrent(Long campaignId, Long companySiteId);
ResultDTO updateListContactQuestResult(ContactQuestResultDTO dto);
String getDialModeAtCurrent(Long companySiteId, Long campaignId);
ResultDTO getContactCustResultById(Long contactCustResultId);
ResultDTO updateCampaignCustomer(CampaignCustomerDTO dto);
ResultDTO updateSurveyStatus(CustomerTimeDTO dto, UserSession userSession);
}
......@@ -70,6 +70,8 @@ public interface CampaignService {
ResultDTO getCustomerListInformation(CampaignRequestDTO dto);
ResultDTO getCountIndividualOnList(CampaignRequestDTO dto);
ResultDTO saveCustomerCampaign(CampaignRequestDTO dto);
ResultDTO getConnectStatus(Long companySiteId);
......
package com.viettel.campaign.service;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.web.dto.*;
import com.viettel.econtact.filter.UserSession;
......@@ -28,4 +29,6 @@ public interface ScenarioService {
XSSFWorkbook buildTemplate() throws IOException;
Map<String, Object> readAndValidateCustomer(String path, Long scenarioId, Long campaignId, Long companySiteId) throws IOException;
List<ContactQuestResult> getContactQuestResult(Long companySiteId, Long campaignId, Long customerId);
}
......@@ -314,16 +314,12 @@ public class AgentsServiceImpl implements AgentsService {
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(" AND vu.USER_ID NOT IN (SELECT vu.USER_ID");
sqlStrBuilder.append(" FROM CAMPAIGN_AGENT ca");
sqlStrBuilder.append(" INNER JOIN VSA_USERS vu ON ca.AGENT_ID = vu.USER_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'))");
sqlStrBuilder.append(" AND ca.COMPANY_SITE_ID = :p_company_site_id");
sqlStrBuilder.append(" AND ca.CAMPAIGN_ID = :p_campaign_id)");
if (!DataUtil.isNullOrEmpty(userName)) {
sqlStrBuilder.append(" AND UPPER(vu.USER_NAME) LIKE UPPER(:p_user_name)");
......@@ -537,4 +533,28 @@ public class AgentsServiceImpl implements AgentsService {
return resultDTO;
}
@Override
public ResultDTO updateAgent(CampaignAgentDTO campaignAgentDTO) {
ResultDTO resultDTO = new ResultDTO();
try {
if (campaignAgentDTO != null) {
Agents agents = new Agents();
agents.setAgentId(campaignAgentDTO.getAgentId().toString());
agents.setCampaignSystemStatus("AVAILABLE");
agentsRepository.save(agents);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
} catch (Exception e) {
// e.printStackTrace();
}
return resultDTO;
}
}
......@@ -5,6 +5,7 @@ import com.viettel.campaign.mapper.CampaignCompleteCodeMapper;
import com.viettel.campaign.model.ccms_full.CampaignCfg;
import com.viettel.campaign.repository.ccms_full.CampaignCfgRepository;
import com.viettel.campaign.repository.ccms_full.CampaignRepository;
import com.viettel.campaign.service.CampaignCfgService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.DataUtil;
......@@ -157,7 +158,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO createCompleteCode(CampaignCfgDTO completeCodeDTO) {
public ResultDTO createCompleteCode(CampaignCfgDTO completeCodeDTO, Long userId) {
ResultDTO resultDTO = new ResultDTO();
CampaignCompleteCodeMapper compCodeMapper = new CampaignCompleteCodeMapper();
Date today = new Date();
......@@ -165,12 +166,37 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
try {
if (completeCodeDTO != null) {
// insert
compCode = compCodeMapper.toPersistenceBean(completeCodeDTO);
compCode = completeCodeRepository.save(compCode);
// compCode = compCodeMapper.toPersistenceBean(completeCodeDTO);
// compCode = completeCodeRepository.save(compCode);
//
// resultDTO.setErrorCode("0");
// resultDTO.setDescription("Complete Code: " + compCode.getCampaignCompleteCodeId() + " created!");
CampaignCfg cl = new CampaignCfg();
cl.setStatus((short) 1);
cl.setCreateBy(String.valueOf(userId));
cl.setCreateAt(new Date());
cl.setUpdateBy(null);
cl.setUpdateAt(null);
cl.setChanel(completeCodeDTO.getChanel());
cl.setCompleteName(completeCodeDTO.getCompleteName().trim());
cl.setCompleteValue(completeCodeDTO.getCompleteValue());
cl.setCampaignType(completeCodeDTO.getCampaignType());
cl.setDescription(completeCodeDTO.getDescription().trim());
cl.setCompleteType(completeCodeDTO.getCompleteType());
cl.setCompanySiteId(completeCodeDTO.getCompanySiteId());
cl.setCampaignCompleteCodeId(completeCodeDTO.getCampaignCompleteCodeId());
cl.setCampaignId(completeCodeDTO.getCampaignId());
cl.setDurationLock(completeCodeDTO.getDurationLock());
cl.setIsFinish(completeCodeDTO.getIsFinish());
cl.setIsLock(completeCodeDTO.getIsLock());
cl.setIsRecall(completeCodeDTO.getIsRecall());
resultDTO.setErrorCode("0");
resultDTO.setDescription("Complete Code: " + compCode.getCampaignCompleteCodeId() + " created!");
resultDTO.setData(completeCodeRepository.save(cl));
return resultDTO;
} else {
resultDTO.setErrorCode("-2");
resultDTO.setDescription("CompleteCodeDTO null");
......@@ -194,16 +220,18 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
if (completeCodeDTO != null) {
// update
compCode = compCodeMapper.toPersistenceBean(completeCodeDTO);
compCode = completeCodeRepository.save(compCode);
completeCodeRepository.save(compCode);
resultDTO.setErrorCode("0");
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription("Complete Code: " + compCode.getCampaignCompleteCodeId() + " updated!");
} else {
resultDTO.setErrorCode("-2");
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription("CompleteCodeDTO null");
}
} catch (Exception e) {
// e.printStackTrace();
logger.error(e.getMessage(), e);
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
......@@ -240,10 +268,16 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
ResultDTO resultDTO = new ResultDTO();
try {
if (completeCodeDTO != null) {
if (completeCodeRepository.findAllCampaignCfg(completeCodeDTO.getListId(), completeCodeDTO.getCompanySiteId()).size() > 0) {
completeCodeRepository.deletedList(completeCodeDTO.getListId(), completeCodeDTO.getCompanySiteId());
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
......
......@@ -130,6 +130,8 @@ public class CampaignServiceImpl implements CampaignService {
public ResultDTO addNewCampaign(CampaignDTO campaignDTO) {
logger.info("=== Start add new campaign ");
ResultDTO resultDTO = new ResultDTO();
campaignDTO.setCampaignName(campaignDTO.getCampaignName().trim());
campaignDTO.setContent(campaignDTO.getContent().trim());
Campaign campaign = modelMapper.map(campaignDTO, Campaign.class);
Long campaignId;
List<TimeZoneDialModeDTO> timeZoneDialModes = new ArrayList<>();
......@@ -207,6 +209,11 @@ public class CampaignServiceImpl implements CampaignService {
try {
Campaign entity = campaignRepository.findCampaignByCampaignIdAndCompanySiteId(dto.getCampaignId(), dto.getCompanySiteId());
if (entity != null) {
if(entity.getStatus().equals(dto.getStatus().longValue())) {
result.setDescription("Duplicate status");
result.setErrorCode("02");
return result;
}
entity.setStatus(dto.getStatus().longValue());
entity.setUpdateTime(new Date());
entity.setUpdateBy(dto.getUpdateBy());
......@@ -350,7 +357,7 @@ public class CampaignServiceImpl implements CampaignService {
entity.setUpdateBy(campaignDTO.getUpdateBy());
entity.setEndTime(campaignDTO.getEndTime());
campaignRepository.save(entity);
//campaignRepository.save(entity);
UserActionLogDTO userActionLog = new UserActionLogDTO();
userActionLog.setAgentId(null);
......@@ -361,7 +368,7 @@ public class CampaignServiceImpl implements CampaignService {
userActionLog.setEndTime(null);
userActionLog.setObjectId(entity.getCampaignId());
userActionLog.setActionType((short) 6);
userActionLogRepository.insertToUserActionLog(userActionLog);
//userActionLogRepository.insertToUserActionLog(userActionLog);
resultDTO.setData(entity);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
......@@ -627,6 +634,12 @@ public class CampaignServiceImpl implements CampaignService {
return campaignRepositoryCustom.getCustomerListInformation(dto);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO getCountIndividualOnList(CampaignRequestDTO dto) {
return campaignRepositoryCustom.getCountIndividualOnList(dto);
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO saveCustomerCampaign(CampaignRequestDTO dto) {
......@@ -668,7 +681,12 @@ public class CampaignServiceImpl implements CampaignService {
// Lay ra danh sach khach hang can loai bo
List<CampaignCustomer> listCustomerToDelete = campaignCustomerRepository.findListCustomerToDel(companySiteId, campaignId, customerListDTO.getCustomerListId());
for (int j = 0; j < custToDel; j++) {
campaignCustomerRepository.delete(listCustomerToDelete.get(j));
if (listCustomerToDelete.get(j).getStatus() == 0) {
campaignCustomerRepository.delete(listCustomerToDelete.get(j));
} else {
listCustomerToDelete.get(j).setInCampaignStatus((short) 0);
campaignCustomerRepository.save(listCustomerToDelete.get(j));
}
}
}
}
......
......@@ -69,6 +69,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
ResultDTO resultDTO = new ResultDTO();
List<ScenarioAnswerDTO> lstAnswers = new ArrayList<>();
List<ScenarioAnswer> lstAnswersToInsert = new ArrayList<>();
scenarioQuestionDTO.setQuestion(scenarioQuestionDTO.getQuestion().trim());
try {
ScenarioQuestion scenarioQuestion = modelMapper.map(scenarioQuestionDTO, ScenarioQuestion.class);
......@@ -83,6 +84,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
item.setScenarioQuestionId(scenarioQuestion.getScenarioQuestionId());
item.setCreateTime(new Date());
item.setStatus((short) 1);
item.setAnswer(item.getAnswer().trim());
ScenarioAnswer answer = modelMapper.map(item, ScenarioAnswer.class);
lstAnswersToInsert.add(answer);
});
......
......@@ -461,6 +461,12 @@ public class ScenarioServiceImpl implements ScenarioService {
return result;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public List<ContactQuestResult> getContactQuestResult(Long companySiteId, Long campaignId, Long customerId) {
return questResultRepository.findByCompanySiteIdAndCampaignIdAndCustomerId(companySiteId, campaignId, customerId);
}
private boolean validateMappingQuestion(String mappingQuestion, String currentQuestionCode, List<String> lstQuestionCode) {
if (mappingQuestion != null && mappingQuestion.equals(currentQuestionCode)) return false;
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.viettel.campaign.utils;
import org.apache.log4j.Logger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
/**
*
* @author phamky
*/
public class TimeZoneUtils {
private static Long getTimeZone(TimeZone tz) {
return TimeUnit.MILLISECONDS.toHours(tz.getRawOffset());
}
private static Long getTimeZoneToMinutes(TimeZone tz) {
return TimeUnit.MILLISECONDS.toMinutes(tz.getRawOffset());
}
public static String toQueryTimeZoneZero(Date date){
String dateStr = toDateStringWithTimeZoneZero(date);
return "to_date( '"+dateStr+"', 'DD/MM/YYYY HH24:MI:SS')";
}
public static String changeTimeZoneString(String dateStr, TimeZone tz){
try {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = sdf.parse(dateStr);
sdf.setTimeZone(tz);
return sdf.format(date);
} catch (ParseException ex) {
}
return "";
}
public static String changeTimeZoneStringPattern(String dateStr, TimeZone tz, String pattern){
try {
SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Date date = sdf1.parse(dateStr);
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(tz);
return sdf.format(date);
} catch (ParseException ex) {
}
return "";
}
public static String toDateStringWithTimeZoneZero(Date date){
TimeZone tz = getZone(0l);
return toDateStringWithTimeZone(date, tz);
}
public static String toDateStringWithTimeZonePattern(Date date, long tz, String pattern){
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(getZone(tz));
return sdf.format(date);
}
// public static String toHourStringWithTimeZonePattern(Long hour, long tz){
// SimpleDateFormat sdf = new SimpleDateFormat(pattern);
// sdf.setTimeZone(getZone(tz));
// return sdf.format(date);
// }
public static String toDateStringWithTimeZonePattern(Date date, TimeZone tz, String pattern){
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
sdf.setTimeZone(tz);
return sdf.format(date);
}
public static String toDateStringWithTimeZone(Date date, TimeZone tz){
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
sdf.setTimeZone(tz);
return sdf.format(date);
}
public static TimeZone getZone(Long timeZone){
if(timeZone == null){
//timezone is null, return default
return TimeZone.getDefault();
}
String[] ids = TimeZone.getAvailableIDs();
for (String id : ids) {
TimeZone tz = TimeZone.getTimeZone(id);
if(getTimeZone(tz).equals(timeZone)){
//zone need change
return tz;
}
}
return TimeZone.getDefault();
}
public static TimeZone getZoneMinutes(Long timeZone){
if(timeZone == null){
//timezone is null, return default
return TimeZone.getDefault();
}
String[] ids = TimeZone.getAvailableIDs();
for (String id : ids) {
TimeZone tz = TimeZone.getTimeZone(id);
if(getTimeZoneToMinutes(tz).equals(timeZone)){
//zone need change
return tz;
}
}
return TimeZone.getDefault();
}
public static Date changeTimeZone(Date date, Long timeZone){
if(timeZone == null){
//timezone is null, do not change timezone
return date;
}
String[] ids = TimeZone.getAvailableIDs();
for (String id : ids) {
TimeZone tz = TimeZone.getTimeZone(id);
if(getTimeZone(tz).equals(timeZone)){
//zone need change
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
df.setTimeZone(tz);
try {
SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date newDate = df2.parse(df.format(date));
System.out.println(df2.format(newDate));
return newDate;
} catch (ParseException ex) {
}
}
}
return date;
}
public static void main(String args[]){
Date date = new Date();
System.out.println(changeTimeZone(date, -6l));
System.out.println(changeTimeZone(date, 0l));
System.out.println(getZone(0l));
}
}
......@@ -66,4 +66,7 @@ public class CampaignDTO extends BaseDTO {
private String sessionId;
private Long numOfInteractedCus;
private Long numOfNotInteractedCus;
//timezone to get true date
private Double timezone;
}
......@@ -14,7 +14,7 @@ public class ContactCustResultDTO extends BaseDTO {
private Long contactCustResultId;
private Long companySiteId;
private Short callStatus;
private String contactStatus;
private Short contactStatus;
private Short status;
private Integer satisfaction;
private String description;
......@@ -52,7 +52,9 @@ public class ContactCustResultDTO extends BaseDTO {
private String campaignCode;
private String userName;
private String surveyStatus;
private String connectStatus;
private Boolean enableEdit;
private Integer totalRow;
private String eventCall;
}
package com.viettel.campaign.web.dto;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
@Getter
@Setter
public class CustomerTimeDTO extends BaseDTO {
private Long customerTimeId;
private Long companySiteId;
private Long customerId;
private Date startTime;
private Date endTime;
private Short status;
private Date createTime;
private Date updateTime;
private Long createBy;
private Long updateBy;
private Long contactCustResultId;
private String completeValue;
}
......@@ -10,4 +10,5 @@ public class CampaignCfgRequestDTO {
List<Long> listId;
Long companySiteId;
Long campaignCompleteCodeID;
String completeValue;
}
......@@ -12,4 +12,5 @@ public class SearchCustomerRequestDTO extends BaseDTO {
String convertedDateFrom;
String convertedDateTo;
String companySiteId;
Integer timezoneOffset;
}
......@@ -82,4 +82,12 @@ public class AgentsController {
result = agentsService.createMultipleCampaignAgent(campaignAgentRequestDTO);
return result;
}
@PostMapping("/updateAgent")
@ResponseBody
public ResultDTO updateAgent(@RequestBody @Valid CampaignAgentDTO requestDTO) {
ResultDTO result = new ResultDTO();
result = agentsService.updateAgent(requestDTO);
return result;
}
}
package com.viettel.campaign.web.rest;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.CampaignCfgDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.service.CampaignCfgService;
import com.viettel.campaign.web.dto.request_dto.CampaignCfgRequestDTO;
import com.viettel.econtact.filter.UserSession;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.Map;
......@@ -38,13 +41,16 @@ public class CampaignCfgController {
@PostMapping("/create")
@ResponseBody
public ResultDTO createCompleteCode(@RequestBody @Valid CampaignCfgDTO completeCodeDTO) {
public ResultDTO createCompleteCode(@RequestBody @Valid CampaignCfgDTO completeCodeDTO , HttpServletRequest httpServletRequest) {
String xAuthToken = httpServletRequest.getHeader("X-Auth-Token");
UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken);
ResultDTO result = new ResultDTO();
//LogUtil logUtil = new LogUtil();
//logUtil.initKpiLog("createCust")
try {
//LOGGER.info("Returning createCustomer: start");
result = completeCodeService.createCompleteCode(completeCodeDTO);
result = completeCodeService.createCompleteCode(completeCodeDTO, userSession.getUserId());
//LOGGER.info("Returning createCustomer:" + result.getErrorCode());
//logUtil.endKpiLog(customerDTO, 0, result.getErrorCode(), result.getDetail(), CustomerController.class, customerDTO.getAgentProcess(), this.serverPort);
} catch (Exception e) {
......
......@@ -15,6 +15,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.ByteArrayOutputStream;
......@@ -205,6 +206,13 @@ public class CampaignController {
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/getCountIndividualOnList")
@ResponseBody
public ResponseEntity getCountIndividualOnList(@RequestBody CampaignRequestDTO campaignRequestDTO) {
ResultDTO resultDTO = campaignService.getCountIndividualOnList(campaignRequestDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@PostMapping("/saveCustomerCampaign")
@ResponseBody
public ResponseEntity saveCustomerCampaign(@RequestBody CampaignRequestDTO campaignRequestDTO) {
......
package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*;
......@@ -25,7 +24,7 @@ import java.util.List;
@RestController
@RequestMapping("/ipcc/campaign/execute")
@CrossOrigin
//@CrossOrigin
public class CampaignExecuteController {
private static final Logger logger = LoggerFactory.getLogger(CampaignController.class);
......@@ -35,9 +34,15 @@ public class CampaignExecuteController {
@PostMapping("/searchCampaignExecute")
@ResponseBody
public ResponseEntity<ResultDTO> searchCampaignExecute(@RequestBody CampaignRequestDTO requestDto, HttpServletRequest request) {
String xAuthToken = request.getHeader("X-Auth-Token");
ResultDTO result = campaignExecuteService.searchCampaignExecute(requestDto, xAuthToken);
public ResponseEntity<ResultDTO> searchCampaignExecute(@RequestBody CampaignRequestDTO requestDto) {
ResultDTO result = campaignExecuteService.searchCampaignExecute(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/checkExecuteCampaign")
@ResponseBody
public ResponseEntity<ResultDTO> checkExecuteCampaign(@RequestBody CampaignRequestDTO requestDto) {
ResultDTO result = campaignExecuteService.checkExecuteCampaign(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......@@ -69,13 +74,6 @@ public class CampaignExecuteController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/getCallStatus")
@ResponseBody
public ResponseEntity<ResultDTO> getCallStatus(@RequestBody CampaignRequestDTO requestDto) {
ResultDTO result = campaignExecuteService.getCallStatus(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@GetMapping("/countRecallCustomer")
@ResponseBody
public ResponseEntity countRecallCustomer(@RequestParam("companySiteId") Long companySiteId, @RequestParam("agentId") Long agentId) {
......@@ -90,6 +88,13 @@ public class CampaignExecuteController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/getLogoutContactResult")
@ResponseBody
public ResponseEntity<ResultDTO> getLogoutContactResult(@RequestBody ReceiveCustLogDTO requestDto) {
ResultDTO result = campaignExecuteService.getLogoutContactResult(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/searchInteractiveResult")
@ResponseBody
public ResponseEntity<ResultDTO> searchInteractiveResult(@RequestBody CampaignRequestDTO dto) throws Exception {
......@@ -136,12 +141,12 @@ public class CampaignExecuteController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/callCustomer")
@PostMapping("/updateContactCustResult")
@ResponseBody
public ResponseEntity<ResultDTO> callCustomer(@RequestBody ContactCustResultDTO requestDto, HttpServletRequest request) {
public ResponseEntity<ResultDTO> updateContactCustResult(@RequestBody ContactCustResultDTO requestDto, HttpServletRequest request) {
String xAuthToken = request.getHeader("X-Auth-Token");
UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken);
ResultDTO result = campaignExecuteService.callCustomer(requestDto, userSession);
ResultDTO result = campaignExecuteService.updateContactCustResult(requestDto, userSession);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......@@ -166,11 +171,19 @@ public class CampaignExecuteController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/createListContactQuestResult")
@PutMapping("/createListContactQuestResult")
@ResponseBody
public ResponseEntity<ResultDTO> createListContactQuestResult(@RequestBody List<ContactQuestResultDTO> dtoList) {
ResultDTO result = null;
result = campaignExecuteService.createListContacQuestResult(dtoList);
result = campaignExecuteService.createListContactQuestResult(dtoList);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PutMapping("/updateListContactQuestResult")
@ResponseBody
public ResponseEntity<ResultDTO> updateListContactQuestResult(@RequestBody ContactQuestResultDTO dto) {
ResultDTO result = null;
result = campaignExecuteService.updateListContactQuestResult(dto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......@@ -187,4 +200,29 @@ public class CampaignExecuteController {
ResultDTO result = campaignExecuteService.getContactCustResultById(contactCustResultId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/draftAtTen")
@ResponseBody
public ResponseEntity<ResultDTO> draftAtTen(@RequestBody ContactCustResultDTO requestDto, HttpServletRequest request) {
String xAuthToken = request.getHeader("X-Auth-Token");
UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken);
ResultDTO result = campaignExecuteService.draftAtTen(requestDto, userSession);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/updateCampaignCustomer")
@ResponseBody
public ResponseEntity<ResultDTO> updateCampaignCustomer(@RequestBody CampaignCustomerDTO requestDto) {
ResultDTO result = campaignExecuteService.updateCampaignCustomer(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/updateSurveyStatus")
@ResponseBody
public ResponseEntity<ResultDTO> updateSurveyStatus(@RequestBody CustomerTimeDTO requestDto, HttpServletRequest request) {
String xAuthToken = request.getHeader("X-Auth-Token");
UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken);
ResultDTO result = campaignExecuteService.updateSurveyStatus(requestDto, userSession);
return new ResponseEntity<>(result, HttpStatus.OK);
}
}
......@@ -37,7 +37,7 @@ import java.util.Map;
@RequestMapping("/ipcc/customer")
@CrossOrigin(origins = "*")
public class CustomerController {
private CustomerQueryRepository customerQueryRepo;
private CustomerQueryRepository customerQueryRepo;
private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class);
......@@ -76,9 +76,9 @@ public class CustomerController {
@PostMapping("/delete")
@ResponseBody
public ResultDTO deleteCustomer(@RequestBody @Valid CustomerRequestDTO customerRequestDTO) {
ResultDTO result = new ResultDTO();
result = customerService.deleteCustomer(customerRequestDTO);
return result;
ResultDTO resultDTO = new ResultDTO();
resultDTO = customerService.deleteCustomer(customerRequestDTO);
return resultDTO;
}
@PostMapping("/deleteIds")
......@@ -198,11 +198,8 @@ public class CustomerController {
try {
UserSession userSession = (UserSession) RedisUtil.getInstance().get(request.getHeader("X-Auth-Token"));
if (file.isEmpty()) {
return new ResponseEntity<>("file-empty", HttpStatus.OK);
return new ResponseEntity<>("file-empty", HttpStatus.NO_CONTENT);
}
// if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
// return new ResponseEntity<>("template-invalid", HttpStatus.OK);
// }
String path = saveUploadFile(file);
List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, Long.parseLong(customerListId));
......@@ -265,18 +262,15 @@ public class CustomerController {
}
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"));
File uploadFolder = new File(Config.EXCEL_DIR);
if (!uploadFolder.exists()) {
uploadFolder.mkdir();
}
// Path path = Paths.get(BundleUtils.getGlobalConfig("import.uploadFolder"), fileName);
Path path = Paths.get(Config.EXCEL_DIR, fileName);
Files.write(path, content);
return path.toString();
......@@ -286,7 +280,7 @@ public class CustomerController {
return null;
}
// @GetMapping("/query")
// @GetMapping("/query")
// public ResponseEntity<List<Customer>> query(@RequestParam(value = "search") String query) {
// List<Customer> things = customerQueryRepo.findAll(query);
// if (things.isEmpty()) {
......@@ -294,16 +288,16 @@ public class CustomerController {
// }
// return ResponseEntity.ok(things);
// }
@GetMapping(path = "", produces = { MediaType.APPLICATION_JSON_VALUE })
@GetMapping(path = "", produces = {MediaType.APPLICATION_JSON_VALUE})
public ResponseEntity<List<Customer>> query(@RequestParam(value = "search") String query) {
List<Customer> result = null;
try {
result= customerService.searchByQuery(query);
}catch (IllegalArgumentException iae){
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
result = customerService.searchByQuery(query);
} catch (IllegalArgumentException iae) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
.body(result);
}
return ResponseEntity.status(HttpStatus.OK)
return ResponseEntity.status(HttpStatus.OK)
.body(result);
}
......@@ -316,7 +310,7 @@ public class CustomerController {
@PostMapping("/searchIndividualCustomer")
@ResponseBody
public ResponseEntity searchCustomizeFields(@RequestBody CampaignCustomerDTO campaignCustomerDTO ) {
public ResponseEntity searchCustomizeFields(@RequestBody CampaignCustomerDTO campaignCustomerDTO) {
ResultDTO result = customerService.searchCustomizeFields(campaignCustomerDTO);
return new ResponseEntity<>(result, HttpStatus.OK);
}
......
package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.service.ScenarioService;
import com.viettel.campaign.utils.BundleUtils;
......@@ -36,7 +37,7 @@ import java.util.*;
@RestController
@RequestMapping("/ipcc/campaign/scenario")
@CrossOrigin
@CrossOrigin(origins = "*")
public class ScenarioController {
private static final Logger logger = LoggerFactory.getLogger(ScenarioController.class);
......@@ -147,4 +148,9 @@ public class ScenarioController {
return null;
}
@RequestMapping(value = "/getContactQuestResult", method = RequestMethod.GET)
public List<ContactQuestResult> getContactQuestResult(@RequestParam Long companySiteId, @RequestParam Long campaignId, @RequestParam Long customerId) {
return scenarioService.getContactQuestResult(companySiteId, campaignId, customerId);
}
}
......@@ -89,7 +89,9 @@ customer.yes = Yes
customer.not = No
customer.noData = Template empty
customer.nameRequired = Full name required;
customer.emailMax50 = Email must less than 50 character;
customer.emailMax100=Email must less than 100 character;
customer.invalidRecord=Invalid Record, required one more contact information;
customer.onlyNumber=Phone contain number only;
customer.importSuccess = Import Successful
customer.importFailed = Import Failed
customer.errorValidate = Error while validating
......@@ -102,6 +104,7 @@ customer.importCustomer = IMPORT CUSTOMER
customer.notice = Attention: A record is valid when Full Name is not null and one of three fields Main phone, secondary phone or email is not null
customer.emailInvalid=Invalid email;
customer.emailExists=Email exists;
customer.cusTypeInvalid=Customer type Invalid;
common.fileNotSelected=Please select a file
common.fileInvalidFormat=File invalid
......
......@@ -91,10 +91,9 @@ customer.yes = Có
customer.not = Khô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.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.emailMax100=Email không được quá 100 kí tự;
customer.invalidRecord=Bắt buộc nhập 1 trong 3 thông tin liên lạc(Số điện thoại chính, Số điện thoại phụ, Email);
customer.onlyNumber=Số điện thoại chỉ được nhập số;
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
......@@ -107,6 +106,7 @@ customer.importCustomer = IMPORT KHÁCH HÀNG
customer.notice = Chú ý: 1 bản ghi được coi là hợp lệ bắt buộc phải có thông tin Họ và Tên và 1 trong 3 thông tin liên lạc (số điện thoại chính, số điện thoại phụ hoặc email)
customer.emailInvalid=Email không đúng định dạng;
customer.emailExists=Email đã tồn tại;
customer.cusTypeInvalid=Loại khách hàng không hợp lệ;
common.fileNotSelected=Bạn chưa chọn file
common.fileInvalidFormat=File không hợp lệ
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment