Commit bc6c4f74 authored by Tu Bach's avatar Tu Bach

tubn campaign execute update

parent ae734b93
...@@ -19,6 +19,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> { ...@@ -19,6 +19,8 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
Page<Customer> findAll(Pageable pageable); Page<Customer> findAll(Pageable pageable);
Customer getByCustomerId(Long customerId);
List<Customer> findByCustomerId(Long customerId); List<Customer> findByCustomerId(Long customerId);
@Query("FROM Customer WHERE name = ?1") @Query("FROM Customer WHERE name = ?1")
......
...@@ -15,4 +15,6 @@ import java.util.List; ...@@ -15,4 +15,6 @@ import java.util.List;
public interface CustomerTimeRepository extends JpaRepository<CustomerTime, Long> { public interface CustomerTimeRepository extends JpaRepository<CustomerTime, Long> {
List<CustomerTime> findByCustomerId(Long customerId); List<CustomerTime> findByCustomerId(Long customerId);
CustomerTime findByCompanySiteIdAndCustomerId(Long companySiteId, Long customerId);
} }
...@@ -4,4 +4,5 @@ import com.viettel.campaign.model.ccms_full.ReceiveCustLog; ...@@ -4,4 +4,5 @@ import com.viettel.campaign.model.ccms_full.ReceiveCustLog;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
public interface ReceiveCustLogRepository extends JpaRepository<ReceiveCustLog, Long> { public interface ReceiveCustLogRepository extends JpaRepository<ReceiveCustLog, Long> {
ReceiveCustLog getByReceiveCustLogId(Long receiveCustLogId);
} }
...@@ -105,6 +105,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -105,6 +105,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
public List<ContactCustResultDTO> getInteractiveResult(CampaignRequestDTO dto, Pageable pageable) { public List<ContactCustResultDTO> getInteractiveResult(CampaignRequestDTO dto, Pageable pageable) {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
List<ContactCustResultDTO> list = new ArrayList<>(); List<ContactCustResultDTO> list = new ArrayList<>();
TimeZone tzClient = TimeZoneUtils.getZoneMinutes(dto.getTimezone());
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession(); Session session = sessionFactory.openSession();
...@@ -125,7 +126,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -125,7 +126,7 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
sql.append(" CC2.COMPLETE_NAME AS surveyStatus, "); sql.append(" CC2.COMPLETE_NAME AS surveyStatus, ");
sql.append(" C.STATUS AS status, "); sql.append(" C.STATUS AS status, ");
sql.append(" CCR.STATUS AS recordStatus, "); sql.append(" CCR.STATUS AS recordStatus, ");
sql.append(" (( CCR.END_TIME - CCR.START_CALL ) * 24 * 60 * 60) AS callTime, "); sql.append(" ROUND(( CCR.END_TIME - CCR.START_CALL ) * 24 * 60 * 60) AS callTime, ");
sql.append(" C.CAMPAIGN_ID AS campaignId, "); sql.append(" C.CAMPAIGN_ID AS campaignId, ");
sql.append(" CUS.CUSTOMER_ID AS customerId "); sql.append(" CUS.CUSTOMER_ID AS customerId ");
sql.append("FROM CONTACT_CUST_RESULT CCR "); sql.append("FROM CONTACT_CUST_RESULT CCR ");
...@@ -133,11 +134,11 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -133,11 +134,11 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
sql.append(" INNER JOIN VSA_USERS VU ON CCR.AGENT_ID = VU.USER_ID "); sql.append(" INNER JOIN VSA_USERS VU ON CCR.AGENT_ID = VU.USER_ID ");
sql.append(" INNER JOIN CUSTOMER CUS ON CCR.CUSTOMER_ID = CUS.CUSTOMER_ID "); sql.append(" INNER JOIN CUSTOMER CUS ON CCR.CUSTOMER_ID = CUS.CUSTOMER_ID ");
sql.append(" INNER JOIN CAMPAIGN_COMPLETE_CODE CC1 ON CCR.CONTACT_STATUS = CC1.COMPLETE_VALUE "); sql.append(" INNER JOIN CAMPAIGN_COMPLETE_CODE CC1 ON CCR.CONTACT_STATUS = CC1.COMPLETE_VALUE ");
sql.append(" LEFT JOIN CAMPAIGN_COMPLETE_CODE CC2 ON CCR.CALL_STATUS = CC2.COMPLETE_VALUE "); sql.append(" LEFT JOIN CAMPAIGN_COMPLETE_CODE CC2 ON CCR.CALL_STATUS = CC2.COMPLETE_VALUE ");
sql.append("WHERE CCR.STATUS <> 0 "); sql.append("WHERE CCR.STATUS <> 0 ");
sql.append(" AND CCR.COMPANY_SITE_ID = :p_company_site_id "); sql.append(" AND CCR.COMPANY_SITE_ID = :p_company_site_id ");
sql.append(" AND to_date(CCR.CREATE_TIME, 'DD/MM/RR') >= to_date(:p_date_from, 'DD/MM/RR') "); sql.append(" AND to_date(CCR.CREATE_TIME, 'DD/MM/RR') >= to_date(:p_date_from, 'DD/MM/YYYY HH24:MI:SS') ");
sql.append(" AND to_date(CCR.CREATE_TIME, 'DD/MM/RR') <= to_date(:p_date_to, 'DD/MM/RR') "); sql.append(" AND to_date(CCR.CREATE_TIME, 'DD/MM/RR') <= to_date(:p_date_to, 'DD/MM/YYYY HH24:MI:SS') ");
if (!DataUtil.isNullOrEmpty(dto.getCustomerId())) { if (!DataUtil.isNullOrEmpty(dto.getCustomerId())) {
sql.append(" AND CCR.CUSTOMER_ID LIKE (:p_customer_id) "); sql.append(" AND CCR.CUSTOMER_ID LIKE (:p_customer_id) ");
...@@ -185,8 +186,10 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -185,8 +186,10 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
SQLQuery query = session.createSQLQuery(sql.toString()); SQLQuery query = session.createSQLQuery(sql.toString());
query.setParameter("p_company_site_id", dto.getCompanySiteId()); query.setParameter("p_company_site_id", dto.getCompanySiteId());
query.setParameter("p_date_from", dto.getFromDate()); //query.setParameter("p_date_from", dto.getFromDate());
query.setParameter("p_date_to", dto.getToDate()); query.setParameter("p_date_from", TimeZoneUtils.toDateStringWithTimeZone(DateTimeUtil.parseDate("dd/MM/yyyy", dto.getFromDate()), tzClient));
//query.setParameter("p_date_to", dto.getToDate());
query.setParameter("p_date_to", TimeZoneUtils.toDateStringWithTimeZone(DateTimeUtil.parseDate("dd/MM/yyyy", dto.getToDate()), tzClient));
if (!DataUtil.isNullOrEmpty(dto.getCustomerId())) { if (!DataUtil.isNullOrEmpty(dto.getCustomerId())) {
query.setParameter("p_customer_id", "%" + query.setParameter("p_customer_id", "%" +
......
...@@ -383,14 +383,18 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -383,14 +383,18 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
public ResultDTO getListStatus(String completeValue, Short completeType, Long companySiteId) { public ResultDTO getListStatus(String completeValue, Short completeType, Long companySiteId) {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
List<CampaignCfg> list = new ArrayList<>(); List<CampaignCfg> list = new ArrayList<>();
CampaignCfg cfg = new CampaignCfg();
try { try {
if (completeValue == null || completeValue.equalsIgnoreCase("null")) if (completeValue == null || completeValue.equalsIgnoreCase("null"))
list = completeCodeRepository.getCustomerStatusByType(completeType, companySiteId); list = completeCodeRepository.getCustomerStatusByType(completeType, companySiteId);
else if (completeType == null)
cfg = completeCodeRepository.findByCompanySiteIdAndCompleteValue(companySiteId, completeValue);
else else
list = completeCodeRepository.getCustomerStatus(completeValue, completeType, companySiteId); list = completeCodeRepository.getCustomerStatus(completeValue, completeType, companySiteId);
resultDTO.setListData(list); resultDTO.setListData(list);
resultDTO.setData(cfg);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS); resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS); resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -18,6 +18,7 @@ public class CampaignCustomerDTO extends BaseDTO{ ...@@ -18,6 +18,7 @@ public class CampaignCustomerDTO extends BaseDTO{
private Date recallTime; private Date recallTime;
private Long recallCount = 0L; private Long recallCount = 0L;
private Date callTime; private Date callTime;
private Long callTimeL;
private Long customerListId; private Long customerListId;
private Short inCampaignStatus; private Short inCampaignStatus;
private Date sendTime; private Date sendTime;
......
...@@ -40,7 +40,8 @@ public class ContactCustResultDTO extends BaseDTO { ...@@ -40,7 +40,8 @@ public class ContactCustResultDTO extends BaseDTO {
private Short isFinalRecall; private Short isFinalRecall;
private Short isSendEmail = 0; private Short isSendEmail = 0;
private Long saledOnTpin; private Long saledOnTpin;
private Long endTime; // api get call return Long private Long endTimeL; // api get call return Long
private Date endTime;
// private Date endTime; // private Date endTime;
private Long waitTime; private Long waitTime;
private String dialMode; private String dialMode;
...@@ -59,4 +60,5 @@ public class ContactCustResultDTO extends BaseDTO { ...@@ -59,4 +60,5 @@ public class ContactCustResultDTO extends BaseDTO {
private Integer totalRow; private Integer totalRow;
private String eventCall; private String eventCall;
private Boolean checkUpdate = false;
} }
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