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