Commit 017b7bd8 authored by Tu Bach's avatar Tu Bach

tubn campaign execute senario

parent cb391bbf
......@@ -2,31 +2,21 @@ package com.viettel.campaign.mapper;
import com.viettel.campaign.model.ccms_full.CampaignAgent;
import com.viettel.campaign.web.dto.CampaignAgentsDTO;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
public class CampaignAgentsMapper extends BaseMapper<CampaignAgent, CampaignAgentsDTO> {
@Autowired
ModelMapper modelMapper;
@Override
public CampaignAgentsDTO toDtoBean(CampaignAgent campaignAgent) {
CampaignAgentsDTO obj = new CampaignAgentsDTO();
obj.setAgentId(campaignAgent.getAgentId());
obj.setCampaignAgentId(campaignAgent.getCampaignAgentId());
obj.setCampaignId(campaignAgent.getCampaignId());
obj.setCompanySiteId(campaignAgent.getCompanySiteId());
obj.setFilterType(campaignAgent.getFilterType());
obj.setReSchedule(campaignAgent.getReSchedule());
obj.setStatus(campaignAgent.getStatus());
return obj;
return modelMapper.map(campaignAgent, CampaignAgentsDTO.class);
}
@Override
public CampaignAgent toPersistenceBean(CampaignAgentsDTO dtoBean) {
CampaignAgent obj = new CampaignAgent();
obj.setAgentId(dtoBean.getAgentId());
obj.setCampaignAgentId(dtoBean.getCampaignAgentId());
obj.setCampaignId(dtoBean.getCampaignId());
obj.setCompanySiteId(dtoBean.getCompanySiteId());
obj.setFilterType(dtoBean.getFilterType());
obj.setReSchedule(dtoBean.getReSchedule());
obj.setStatus(dtoBean.getStatus());
return obj;
return modelMapper.map(dtoBean, CampaignAgent.class);
}
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "CONTACT_CUST_RESULT")
@Getter
@Setter
public class ContactCustResult implements Serializable {
@Id
@NotNull
@GeneratedValue(generator = "CONTACT_CUST_RESULT_SEQ")
@SequenceGenerator(name = "CONTACT_CUST_RESULT_SEQ", sequenceName = "CONTACT_CUST_RESULT_SEQ", allocationSize = 1)
@Basic(optional = false)
@Column(name = "CONTACT_CUST_RESULT_ID")
private Long contactCustResultId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "CALL_STATUS")
private Short callStatus;
@Column(name = "CONTACT_STATUS")
@NotNull
private Short contactStatus;
@Column(name = "STATUS")
private Short status;
@Column(name = "SATISFACTION")
private Integer satisfaction;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "CREATE_TIME")
@NotNull
private Date createTime;
@Column(name = "AGENT_ID")
private Long agentId;
@Column(name = "UPDATE_TIME")
private Date updateTime;
@Column(name = "UPDATE_BY")
private Long updateBy;
@Column(name = "CAMPAIGN_ID")
@NotNull
private Long campaignId;
@Column(name = "OLD_CONTACT_CUST_RESULT_ID")
private Long oldContactCustResultId;
@Column(name = "CUSTOMER_ID")
@NotNull
private Long customerId;
@Column(name = "DURATION_CALL")
private Long durationCall;
@Column(name = "START_CALL")
private Date startCall;
@Column(name = "RECEIVE_CUST_LOG_ID")
@NotNull
private Long receiveCustLogId;
@Column(name = "IPCC_CALL_STATUS")
private Short ipccCallStatus;
@Column(name = "CALL_ID")
private String callId;
@Column(name = "PHONE_NUMBER")
@NotNull
private String phoneNumber;
@Column(name = "RECEIVE_TIME")
@NotNull
private Date receiveTime;
@Column(name = "PRE_END_TIME")
private Date preEndTime;
@Column(name = "URL_CALL")
private String urlCall;
@Column(name = "TRANSACTION_ID")
private String transactionId;
@Column(name = "RECALL_TIME")
private Date recallTime;
@Column(name = "IS_FINAL_RECALL")
private Short isFinalRecall;
@Column(name = "IS_SEND_EMAIL")
private Short isSendEmail = 0;
@Column(name = "SALED_ON_TPIN")
private Long saledOnTpin;
@Column(name = "END_TIME")
private Date endTime;
@Column(name = "WAIT_TIME")
private Long waitTime;
@Column(name = "DIAL_MODE")
private String dialMode;
@Column(name = "WRAPUP_TIME")
private Long wrapupTime;
@Column(name = "TIME_MAKE_CALL")
private Long timeMakeCall = 0L;
@Column(name = "TIME_RECEIVE_CUST")
private Long timeReceiveCust = 0L;
}
package com.viettel.campaign.model.ccms_full;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Entity
@Table(name = "CONTACT_QUEST_RESULT")
@Getter
@Setter
public class ContactQuestResult implements Serializable {
@Id
@Column(name = "CONTACT_QUEST_RESULT_ID")
@NotNull
private Long contactQuestResultId;
@Column(name = "CONTACT_CUST_RESULT_ID")
@NotNull
private Long contactCustResultId;
@Column(name = "COMPANY_SITE_ID")
private Long companySiteId;
@Column(name = "SCENARIO_QUESTION_ID")
@NotNull
private Long scenarioQuestionId;
@Column(name = "OTHER_OPINION")
private String otherOpinion;
@Column(name = "SCENARIO_ANSWER_ID")
private Long scenarioAnswerId;
@Column(name = "STATUS")
private Short status;
@Column(name = "OLD_CONTACT_CUST_RESULT_ID")
private Long oldContactCustResultId;
@Column(name = "CUSTOMER_ID")
@NotNull
private Long customerId;
@Column(name = "CAMPAIGN_ID")
@NotNull
private Long campaignId;
}
......@@ -17,7 +17,6 @@ public interface CampaignCompleteCodeRepository extends JpaRepository<CampaignCo
@Query(" select u FROM CampaignCompleteCode u WHERE u.status = 1")
Page<CampaignCompleteCode> findAll(Pageable pageable);
@Query("FROM CampaignCompleteCode WHERE completeName LIKE concat('%', :name, '%') ")
List<CampaignCompleteCode> findByName(@Param("name") String name, Pageable pageable);
......@@ -27,11 +26,11 @@ public interface CampaignCompleteCodeRepository extends JpaRepository<CampaignCo
@Query("update CampaignCompleteCode 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);
List<CampaignCompleteCode> findCampaignCompleteCodesByCompanySiteId(Long companySiteId);
@Query(value="SELECT max(completeValue) FROM CampaignCompleteCode WHERE companySiteId = :companySiteId GROUP BY companySiteId")
Short findByMaxCompanySiteId(Long companySiteId);
@Modifying
@Query("update CampaignCompleteCode 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);
......
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.stereotype.Repository;
@Repository
public interface ContactCustResultRepository extends JpaRepository<ContactCustResult, Long> {
}
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.web.dto.ContactQuestResultDTO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface ContactQuestResultRepository extends JpaRepository<ContactQuestResult, Long> {
List<ContactQuestResultDTO> findByCompanySiteIdAndCampaignId(Long companySiteId, Long campaignId);
}
......@@ -33,4 +33,6 @@ public interface CampaignExecuteService {
ResultDTO getCallLog(ReceiveCustLogDTO dto);
ResultDTO getAgentLogout(CampaignRequestDTO dto);
ResultDTO callCustomer(ContactCustResultDTO dto);
}
......@@ -3,6 +3,7 @@ package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.mapper.ReceiveCustLogMapper;
import com.viettel.campaign.model.acd_full.Agents;
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.ccms_full.*;
......@@ -15,6 +16,7 @@ import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.modelmapper.ModelMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -30,6 +32,12 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
private static final Logger logger = LoggerFactory.getLogger(CampaignExecuteServiceImp.class);
private SimpleDateFormat formatter = new SimpleDateFormat(Constants.DATE_FORMAT.FOMART_DATE_TYPE_1);
@Autowired
ModelMapper modelMapper;
@Autowired
ContactCustResultRepository ccResultRepository;
@Autowired
ReceiveCustLogRepository custLogRepository;
......@@ -365,4 +373,23 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
return result;
}
@Override
public ResultDTO callCustomer(ContactCustResultDTO dto) {
ResultDTO result = new ResultDTO();
try {
ContactCustResult ccr = ccResultRepository.save(modelMapper.map(dto, ContactCustResult.class));
result.setErrorCode(Constants.ApiErrorCode.SUCCESS);
result.setDescription(Constants.ApiErrorDesc.SUCCESS);
result.setData(ccr);
} catch (Exception e) {
e.printStackTrace();
result.setErrorCode(Constants.ApiErrorCode.ERROR);
result.setDescription(Constants.ApiErrorDesc.ERROR);
}
return result;
}
}
......@@ -10,27 +10,47 @@ import java.util.Date;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class ContactCustResultDTO extends BaseDTO{
private Long contacCustResultId;
private Long contactCustResultId;
private Long companySiteId;
private Short callStatus;
private Short recordStatus;
private Short contactStatus;
private Short status;
private Integer satisfaction;
private String description;
private Date createTime;
private Long callTime;
private Long agentId;
private Date updateTime;
private Long updateBy;
private Long campaignId;
private String campaignName;
private Long oldContactCustResultId;
private Long customerId;
private Long durationCall;
private Date startCall;
private Long receiveCustLogId;
private Short ipccCallStatus;
private String callId;
private String phoneNumber;
private Date receiveTime;
private Date preEndTime;
private String urlCall;
private String transactionId;
private Date recallTime;
private Short isFinalRecall;
private Short isSendEmail = 0;
private Long saledOnTpin;
private Date endTime;
private Long waitTime;
private String dialMode;
private Long wrapupTime;
private Long timeMakeCall = 0L;
private Long timeReceiveCust = 0L;
private Short recordStatus;
private Long callTime;
private String campaignName;
private String customerName;
private Long customerId;
private String contactStatus;
private String campaignCode;
private String userName;
private String surveyStatus;
private Short status;
private Boolean enableEdit;
}
package com.viettel.campaign.web.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ContactQuestResultDTO extends BaseDTO {
private Long contactQuestResultId;
private Long contactCustResultId;
private Long companySiteId;
private Long scenarioQuestionId;
private String otherOpinion;
private Long scenarioAnswerId;
private Short status;
private Long oldContactCustResultId;
private Long customerId;
private Long campaignId;
}
......@@ -4,10 +4,7 @@ import com.viettel.campaign.model.ccms_full.TimeRangeDialMode;
import com.viettel.campaign.model.ccms_full.TimeZoneDialMode;
import com.viettel.campaign.service.CampaignExecuteService;
import com.viettel.campaign.service.CampaignService;
import com.viettel.campaign.web.dto.CampaignCustomerDTO;
import com.viettel.campaign.web.dto.CampaignDTO;
import com.viettel.campaign.web.dto.ReceiveCustLogDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CampaignRequestDTO;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
......@@ -69,6 +66,13 @@ public class CampaignController {
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/callCustomer")
@ResponseBody
public ResponseEntity<ResultDTO> callCustomer(@RequestBody ContactCustResultDTO requestDto) {
ResultDTO result = campaignExecuteService.callCustomer(requestDto);
return new ResponseEntity<>(result, HttpStatus.OK);
}
@PostMapping("/getAgentLogout")
@ResponseBody
public ResponseEntity<ResultDTO> getAgentLogout(@RequestBody CampaignRequestDTO requestDto) {
......
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