Commit 99ff98b1 authored by đinh thị đầm's avatar đinh thị đầm

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
parents 57d1fca3 a6847133
...@@ -18,9 +18,7 @@ public interface CampaignAgentRepository extends JpaRepository<CampaignAgent, Lo ...@@ -18,9 +18,7 @@ public interface CampaignAgentRepository extends JpaRepository<CampaignAgent, Lo
@Query(value = "SELECT campaign_agent_seq.nextval FROM DUAL", nativeQuery = true) @Query(value = "SELECT campaign_agent_seq.nextval FROM DUAL", nativeQuery = true)
Long getNextSeqId(); Long getNextSeqId();
@Modifying List<CampaignAgent> findByCampaignIdAndAgentId(Long campaignId, Long agentId);
@Query("UPDATE CampaignAgent SET status = :status WHERE agentId = :agentId AND campaignId = :campaignId")
void updateCampaignAgentSetStatus(@Param("agentId") Long agentId, @Param("campaignId") Long campaignId, @Param("status") Integer status);
@Modifying @Modifying
@Query("delete from CampaignAgent c where c.campaignAgentId in (:p_campaign_agent_id)") @Query("delete from CampaignAgent c where c.campaignAgentId in (:p_campaign_agent_id)")
......
...@@ -12,26 +12,25 @@ import org.springframework.stereotype.Repository; ...@@ -12,26 +12,25 @@ import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
@Repository @Repository
public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long>{ public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long> {
@Query("FROM CampaignCfg u WHERE u.status = 1 AND u.completeValue NOT IN (1,2,3,4)") @Query("FROM CampaignCfg u WHERE u.status = 1 AND u.completeValue NOT IN (1,2,3,4)")
Page<CampaignCfg> findAll(Pageable pageable); Page<CampaignCfg> findAll(Pageable pageable);
@Query("FROM CampaignCfg WHERE completeName LIKE concat('%', :name, '%') ") @Query("FROM CampaignCfg WHERE completeName LIKE concat('%', :name, '%') ")
List<CampaignCfg> findByName(@Param("name") String name, Pageable pageable); List<CampaignCfg> findByName(@Param("name") String name, Pageable pageable);
List<CampaignCfg> findByCompleteNameContains(String name, Pageable pageable); List<CampaignCfg> findByCompleteNameContains(String name, Pageable pageable);
@Modifying @Modifying
@Query("update CampaignCfg c set c.status = 0 where c.campaignCompleteCodeId in (:p_ids) and c.companySiteId=:p_company_site_id" ) @Query("update CampaignCfg c set c.status = 0 where c.campaignCompleteCodeId in (:p_ids) and c.companySiteId=:p_company_site_id")
int deletedList(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id); int deletedList(@Param("p_ids") List<Long> p_ids, @Param("p_company_site_id") Long p_company_site_id);
List<CampaignCfg> findCampaignCompleteCodesByCompanySiteId(Long companySiteId); List<CampaignCfg> findCampaignCompleteCodesByCompanySiteId(Long companySiteId);
@Query(value="SELECT max(completeValue) FROM CampaignCfg WHERE companySiteId = :companySiteId GROUP BY companySiteId") @Query(value = "SELECT max(completeValue) FROM CampaignCfg WHERE companySiteId = :companySiteId GROUP BY companySiteId")
Short findByMaxCompanySiteId(Long companySiteId); Short findByMaxCompanySiteId(Long companySiteId);
@Modifying @Modifying
@Query("update CampaignCfg c set c.status = 0 where c.campaignCompleteCodeId=:p_campaignCompleteCode_list_id and c.companySiteId=:p_company_site_id") @Query("update CampaignCfg c set c.status = 0 where c.campaignCompleteCodeId=:p_campaignCompleteCode_list_id and c.companySiteId=:p_company_site_id")
int deleteCampaignCompleteCodeBy(@Param("p_campaignCompleteCode_list_id") Long p_campaignCompleteCode_list_id, @Param("p_company_site_id") Long p_company_site_id); int deleteCampaignCompleteCodeBy(@Param("p_campaignCompleteCode_list_id") Long p_campaignCompleteCode_list_id, @Param("p_company_site_id") Long p_company_site_id);
...@@ -39,6 +38,9 @@ public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long>{ ...@@ -39,6 +38,9 @@ public interface CampaignCfgRepository extends JpaRepository<CampaignCfg, Long>{
@Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue = :completeValue AND completeType = :completeType AND companySiteId = :companySiteId") @Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue = :completeValue AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCfg> getCustomerStatus(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId); List<CampaignCfg> getCustomerStatus(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
@Query(value = "FROM CampaignCfg WHERE status = 1 AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCfg> getCustomerStatusByType(@Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
@Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue <> :completeValue AND completeType = :completeType AND companySiteId = :companySiteId") @Query(value = "FROM CampaignCfg WHERE status = 1 AND completeValue <> :completeValue AND completeType = :completeType AND companySiteId = :companySiteId")
List<CampaignCfg> getCustomerStatusWithoutValue(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId); List<CampaignCfg> getCustomerStatusWithoutValue(@Param("completeValue") String completeValue, @Param("completeType") Short completeType, @Param("companySiteId") Long companySiteId);
......
...@@ -21,7 +21,4 @@ public interface CampaignExecuteRepository { ...@@ -21,7 +21,4 @@ public interface CampaignExecuteRepository {
List<ContactCustResultDTO> getInteractiveResult(CampaignRequestDTO dto, Pageable pageable); List<ContactCustResultDTO> getInteractiveResult(CampaignRequestDTO dto, Pageable pageable);
List<ContactCustResultDTO> getExcelInteractiveResult(CampaignRequestDTO dto); List<ContactCustResultDTO> getExcelInteractiveResult(CampaignRequestDTO dto);
List<ContactCustResultDTO> getContactCustById(CampaignRequestDTO dto);
//</editor-fold: hungtt>
} }
package com.viettel.campaign.repository.ccms_full; package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.TimeRangeDialMode; import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -13,13 +15,21 @@ import java.util.List; ...@@ -13,13 +15,21 @@ import java.util.List;
*/ */
@Repository @Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface TimeRangeDialModeRepository extends JpaRepository<TimeRangeDialMode, Long> { public interface TimeRangeDialModeRepository extends JpaRepository<TimeRangeDialMode, Long> {
List<TimeRangeDialMode> findTimeRangeDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId); List<TimeRangeDialMode> findTimeRangeDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT * FROM TIME_RANGE_DIAL_MODE r " + @Query(value = "SELECT * " +
"WHERE r.CAMPAIGN_ID = :campaignId AND r.COMPANY_SITE_ID = :companySiteId AND TO_CHAR(r.START_TIME,'HH24:MI:SS') <= TO_CHAR(SYSDATE,'HH24:MI:SS')", nativeQuery = true) "FROM (SELECT Z.* " +
TimeRangeDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId); " 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 " +
" ) WHERE ROWNUM = 1", nativeQuery = true)
TimeRangeDialMode findDialModeAtCurrent(@Param("companySiteId") Long companySiteId, @Param("campaignId") Long campaignId);
void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId); void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
} }
package com.viettel.campaign.repository.ccms_full; package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode; import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param; import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -13,12 +15,19 @@ import java.util.List; ...@@ -13,12 +15,19 @@ import java.util.List;
*/ */
@Repository @Repository
@Transactional(DataSourceQualify.CCMS_FULL)
public interface TimeZoneDialModeRepository extends JpaRepository<TimeZoneDialMode, Long> { public interface TimeZoneDialModeRepository extends JpaRepository<TimeZoneDialMode, Long> {
List<TimeZoneDialMode> findTimeZoneDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId); List<TimeZoneDialMode> findTimeZoneDialModeByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
@Query(value = "SELECT * FROM TIME_ZONE_DIAL_MODE z " + @Query(value = "SELECT * " +
"WHERE z.CAMPAIGN_ID = :campaignId AND z.COMPANY_SITE_ID = :companySiteId AND concat(z.HOUR, ':', z.MINUTE) <= TO_CHAR(SYSDATE,'HH24:MI')", nativeQuery = true) "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 " +
" ) WHERE ROWNUM = 1", nativeQuery = true)
TimeZoneDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId); TimeZoneDialMode findDialModeAtCurrent(@Param("campaignId") Long campaignId, @Param("companySiteId") Long companySiteId);
void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId); void deleteAllByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
......
...@@ -443,11 +443,6 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository { ...@@ -443,11 +443,6 @@ public class CampaignExecuteRepositoryImp implements CampaignExecuteRepository {
return list; return list;
} }
@Override
public List<ContactCustResultDTO> getContactCustById(CampaignRequestDTO dto) {
return null;
}
private boolean isLower24Hour(Date createTime) { private boolean isLower24Hour(Date createTime) {
Date currTime = new Date(); Date currTime = new Date();
long diffMilSec = currTime.getTime() - createTime.getTime(); long diffMilSec = currTime.getTime() - createTime.getTime();
......
package com.viettel.campaign.service; package com.viettel.campaign.service;
import com.viettel.campaign.model.ccms_full.ContactCustResult;
import com.viettel.campaign.web.dto.*; 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 com.viettel.econtact.filter.UserSession;
...@@ -20,9 +21,6 @@ public interface CampaignExecuteService { ...@@ -20,9 +21,6 @@ public interface CampaignExecuteService {
XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException; XSSFWorkbook exportInteractiveResult(CampaignRequestDTO dto) throws IOException;
List<ContactCustResultDTO> getContactCustById(CampaignRequestDTO dto);
//</editor-fold>
ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto, String xAuthToken); ResultDTO searchCampaignExecute(CampaignRequestDTO requestDto, String xAuthToken);
ResultDTO getExecuteCampaign(CampaignRequestDTO requestDto); ResultDTO getExecuteCampaign(CampaignRequestDTO requestDto);
...@@ -50,4 +48,8 @@ public interface CampaignExecuteService { ...@@ -50,4 +48,8 @@ public interface CampaignExecuteService {
ResultDTO getCustomerRecall(Long campaignId, Long customerId); ResultDTO getCustomerRecall(Long campaignId, Long customerId);
ResultDTO getCustomerInfor(Long companySiteId, Long customerId, Long campaignId); ResultDTO getCustomerInfor(Long companySiteId, Long customerId, Long campaignId);
ResultDTO createListContacQuestResult(List<ContactQuestResultDTO> dtoList);
String getDialModeAtCurrent(Long campaignId, Long companySiteId);
} }
...@@ -334,8 +334,13 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -334,8 +334,13 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
@Transactional(DataSourceQualify.CCMS_FULL) @Transactional(DataSourceQualify.CCMS_FULL)
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<>();
try { try {
List<CampaignCfg> list = completeCodeRepository.getCustomerStatus(completeValue, completeType, companySiteId); if (completeValue == null || completeValue.equalsIgnoreCase("null"))
list = completeCodeRepository.getCustomerStatusByType(completeType, companySiteId);
else
list = completeCodeRepository.getCustomerStatus(completeValue, completeType, companySiteId);
resultDTO.setListData(list); resultDTO.setListData(list);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS); resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
......
...@@ -2,9 +2,7 @@ package com.viettel.campaign.service.impl; ...@@ -2,9 +2,7 @@ package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify; import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.acd_full.Agents; import com.viettel.campaign.model.acd_full.Agents;
import com.viettel.campaign.model.ccms_full.CampaignCustomer; import com.viettel.campaign.model.ccms_full.*;
import com.viettel.campaign.model.ccms_full.ContactCustResult;
import com.viettel.campaign.model.ccms_full.ReceiveCustLog;
import com.viettel.campaign.repository.acd_full.AgentsRepository; import com.viettel.campaign.repository.acd_full.AgentsRepository;
import com.viettel.campaign.repository.ccms_full.*; import com.viettel.campaign.repository.ccms_full.*;
import com.viettel.campaign.service.CampaignExecuteService; import com.viettel.campaign.service.CampaignExecuteService;
...@@ -20,7 +18,6 @@ import org.modelmapper.ModelMapper; ...@@ -20,7 +18,6 @@ import org.modelmapper.ModelMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -71,6 +68,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -71,6 +68,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Autowired @Autowired
CampaignCustomerListColumnRepository campaignCustomerListColumnRepository; CampaignCustomerListColumnRepository campaignCustomerListColumnRepository;
@Autowired
ContactQuestResultRepository contactQuestResultRepository;
public CampaignExecuteServiceImp() throws NoSuchAlgorithmException { public CampaignExecuteServiceImp() throws NoSuchAlgorithmException {
} }
...@@ -235,12 +235,6 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -235,12 +235,6 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return workbook; return workbook;
} }
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public List<ContactCustResultDTO> getContactCustById(CampaignRequestDTO dto) {
return campaignExecuteRepository.getContactCustById(dto);
}
private void writeCellContent(Row row, CellStyle rowStyle, int colNo, Object content) { private void writeCellContent(Row row, CellStyle rowStyle, int colNo, Object content) {
Cell cell = row.createCell(colNo); Cell cell = row.createCell(colNo);
if (content == null) { if (content == null) {
...@@ -288,27 +282,30 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -288,27 +282,30 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override @Override
public ResultDTO getExecuteCampaign(CampaignRequestDTO requestDto) { public ResultDTO getExecuteCampaign(CampaignRequestDTO requestDto) {
ResultDTO result = new ResultDTO(); ResultDTO result = new ResultDTO();
String dialMode = getDialModeAtCurrent(Long.parseLong(requestDto.getCompanySiteId()), Long.parseLong(requestDto.getCampaignId()));
try { try {
Agents agents = agentsRepository.findByAgentId(requestDto.getAgentId());
//TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getCompanySiteId()));
//TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getCompanySiteId()));
if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("LOGOUT")) {
//if (zoneDialMode != null && zoneDialMode.getDialMode().equals(0) || rangeDialMode != null && rangeDialMode.getDialMode().equals(0))
// update acd_full.agents table // update acd_full.agents table
Agents a = new Agents(); Agents agents = agentsRepository.findByAgentId(requestDto.getAgentId());
a = agents; agents.setAgentId(requestDto.getAgentId());
a.setAgentId(requestDto.getAgentId()); agents.setCampaignSystemStatus("AVAILABLE");
a.setCampaignSystemStatus("AVAILABLE"); agents.setCurrentCampaignId(Long.parseLong(requestDto.getCampaignId()));
a.setCurrentCampaignId(Long.parseLong(requestDto.getCampaignId())); agents.setUpdateDate(new Date());
a.setUpdateDate(new Date()); Agents a1 = agentsRepository.save(agents);
agentsRepository.save(a);
// update ccms_full.campaign_agent table // update ccms_full.campaign_agent table
campaignAgentRepository.updateCampaignAgentSetStatus(Long.parseLong(requestDto.getAgentId()), Long.parseLong(requestDto.getCampaignId()), 1); List<CampaignAgent> ca = campaignAgentRepository.findByCampaignIdAndAgentId(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getAgentId()));
for (CampaignAgent item : ca) {
item.setStatus(1);
} }
List<CampaignAgent> ca1 = campaignAgentRepository.saveAll(ca);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR);
} }
return result; return result;
...@@ -317,6 +314,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -317,6 +314,7 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
@Override @Override
public ResultDTO getCustomer(CampaignCustomerDTO dto) { public ResultDTO getCustomer(CampaignCustomerDTO dto) {
ResultDTO result = new ResultDTO(); ResultDTO result = new ResultDTO();
String dialMode = getDialModeAtCurrent(dto.getCompanySiteId(), dto.getCampaignId());
//Agents agents = agentsRepository.findByAgentId(dto.getAgentId()); //Agents agents = agentsRepository.findByAgentId(dto.getAgentId());
//TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getCompanySiteId())); //TimeZoneDialMode zoneDialMode = zoneDialModeRepository.findDialModeAtCurrent(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getCompanySiteId()));
...@@ -529,7 +527,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -529,7 +527,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
try { try {
agentsRepository.updateAgentLogoutFromCampaign(dto.getAgentId(), "LOGOUT"); agentsRepository.updateAgentLogoutFromCampaign(dto.getAgentId(), "LOGOUT");
campaignAgentRepository.updateCampaignAgentSetStatus(Long.parseLong(dto.getAgentId()), Long.parseLong(dto.getCampaignId()), 0); // update ccms_full.campaign_agent table
List<CampaignAgent> ca = campaignAgentRepository.findByCampaignIdAndAgentId(Long.parseLong(dto.getCampaignId()), Long.parseLong(dto.getAgentId()));
for (CampaignAgent item : ca) {
item.setStatus(1);
}
List<CampaignAgent> ca1 = campaignAgentRepository.saveAll(ca);
result.setErrorCode(Constants.ApiErrorCode.SUCCESS); result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS); result.setDescription(Constants.ApiErrorDesc.SUCCESS);
...@@ -685,4 +688,44 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService { ...@@ -685,4 +688,44 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
} }
return resultDTO; return resultDTO;
} }
@Override
public ResultDTO createListContacQuestResult(List<ContactQuestResultDTO> dtoList) {
ResultDTO resultDTO = new ResultDTO();
List<ContactQuestResult> lstContactQuestResult = new ArrayList<>();
for (ContactQuestResultDTO item : dtoList) {
lstContactQuestResult.add(modelMapper.map(item, ContactQuestResult.class));
}
try {
List<ContactQuestResult> dataReturn = contactQuestResultRepository.saveAll(lstContactQuestResult);
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setListData(dataReturn);
} catch (Exception e) {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
@Override
public String getDialModeAtCurrent(Long campaignId, Long companySiteId) {
// 0: manual, 1- Preview, 2-Progressive, 3-Super Progressive, 4- Predictive
try {
TimeRangeDialMode lstTimeRange = rangeDialModeRepository.findDialModeAtCurrent(companySiteId, campaignId);
TimeZoneDialMode lstTimeZone = zoneDialModeRepository.findDialModeAtCurrent(companySiteId, campaignId);
if (lstTimeRange.getTimeRangeDialModeId() != null) {
return lstTimeRange.getDialMode().toString();
} else if (lstTimeZone.getTimeZoneDialModeId() != null) {
return lstTimeZone.getDialMode().toString();
}
} catch (Exception e) {
e.printStackTrace();
}
return "-1";
}
} }
...@@ -1758,9 +1758,8 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1758,9 +1758,8 @@ public class CustomerServiceImpl implements CustomerService {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
try { try {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(" select distinct name value, value key from customize_field_option_value a"); sb.append(" select distinct name value, field_option_value_id key from customize_field_option_value");
sb.append(" inner join customize_field_object b on a.field_option_value_id = b.field_option_value_id"); sb.append(" where field_option_id = :p_field_id");
sb.append(" where a.field_option_id = :p_field_id");
params.put("p_field_id", campaignCustomerDTO.getField()); params.put("p_field_id", campaignCustomerDTO.getField());
......
...@@ -243,6 +243,7 @@ public class DataUtil { ...@@ -243,6 +243,7 @@ public class DataUtil {
} }
return sb.toString(); return sb.toString();
} }
// public static void main(String[] args) { // public static void main(String[] args) {
//// Date rs = DataUtil.toDatefromStringFormat("20170702", "yyyyMMdd"); //// Date rs = DataUtil.toDatefromStringFormat("20170702", "yyyyMMdd");
//// System.out.println(rs); //// System.out.println(rs);
...@@ -263,5 +264,8 @@ public class DataUtil { ...@@ -263,5 +264,8 @@ public class DataUtil {
public static boolean isNullOrZero(Short value) { public static boolean isNullOrZero(Short value) {
return (value == null || value.equals(Short.parseShort("0"))); return (value == null || value.equals(Short.parseShort("0")));
} }
public static boolean isNullOrZero(Integer value) { return (value == null || value.equals(Integer.parseInt("0"))); }
public static boolean isNullOrZero(Integer value) {
return (value == null || value.equals(Integer.parseInt("0")));
}
} }
package com.viettel.campaign.web.rest; package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.service.CampaignExecuteService; import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.utils.RedisUtil; import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*; import com.viettel.campaign.web.dto.*;
...@@ -20,6 +21,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -20,6 +21,7 @@ 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;
@RestController @RestController
@RequestMapping("/ipcc/campaign/execute") @RequestMapping("/ipcc/campaign/execute")
...@@ -163,4 +165,19 @@ public class CampaignExecuteController { ...@@ -163,4 +165,19 @@ public class CampaignExecuteController {
ResultDTO result = campaignExecuteService.getCustomerRecall(campaignId, customerId); ResultDTO result = campaignExecuteService.getCustomerRecall(campaignId, customerId);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
@PostMapping("/createListContactQuestResult")
@ResponseBody
public ResponseEntity<ResultDTO> createListContactQuestResult(@RequestBody List<ContactQuestResultDTO> dtoList) {
ResultDTO result = null;
//ResultDTO result = campaignExecuteService.createListContacQuestResult(dtoList);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@GetMapping("/getDialModeAtCurrent")
@ResponseBody
public ResponseEntity getDialModeAtCurrent(@RequestParam("companySiteId") Long companySiteId, @RequestParam("campaignId") Long campaignId) {
String result = campaignExecuteService.getDialModeAtCurrent(companySiteId, campaignId);
return new ResponseEntity<>(result, HttpStatus.OK);
}
} }
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