Commit c6df5bcc authored by Tu Bach's avatar Tu Bach

tubn campaign execute: bỏ đoạn code check TVV chọn CALLOUT

parent 79e3e7f3
package com.viettel.campaign.service;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioAnswerDTO;
import com.viettel.campaign.web.dto.ScenarioDTO;
import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
import com.viettel.campaign.web.dto.*;
import java.util.List;
......@@ -14,7 +11,10 @@ import java.util.List;
public interface ScenarioService {
Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId);
ResultDTO update(ScenarioDTO scenario);
ResultDTO sortQuestionAndAnswer(ScenarioDTO scenarioDTO);
ResultDTO saveContacQuestResult(ContactQuestResultDTO dto);
}
......@@ -245,7 +245,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
//TimeRangeDialMode rangeDialMode = rangeDialModeRepository.findDialModeAtCurrent(Long.parseLong(requestDto.getCampaignId()), Long.parseLong(requestDto.getCompanySiteId()));
if (agents.getUserStatus() != null && agents.getCampaignSystemStatus() != null) {
if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("AVAILABLE")) {
// tạm thời bỏ qua điều kiện này vì DB ACD không thực thi update được
// if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("AVAILABLE")) {
if (agents.getCampaignSystemStatus().equalsIgnoreCase("AVAILABLE")) {
//if (zoneDialMode != null && zoneDialMode.getDialMode().equals(0) || rangeDialMode != null && rangeDialMode.getDialMode().equals(0))
data.put("dialModeManual", "1");
}
......@@ -267,7 +269,9 @@ public class CampaignExecuteServiceImp implements CampaignExecuteService {
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")) {
// tạm thời bỏ qua điều kiện này vì DB ACD không thực thi update được
// if (agents.getUserStatus().equalsIgnoreCase("CALLOUT") && agents.getCampaignSystemStatus().equalsIgnoreCase("LOGOUT")) {
if (agents.getCampaignSystemStatus().equalsIgnoreCase("LOGOUT")) {
//if (zoneDialMode != null && zoneDialMode.getDialMode().equals(0) || rangeDialMode != null && rangeDialMode.getDialMode().equals(0))
// update acd_full.agents table
Agents a = new Agents();
......
package com.viettel.campaign.service.impl;
import com.viettel.campaign.config.DataSourceQualify;
import com.viettel.campaign.model.ccms_full.ContactQuestResult;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.model.ccms_full.ScenarioAnswer;
import com.viettel.campaign.model.ccms_full.ScenarioQuestion;
import com.viettel.campaign.repository.ccms_full.ScenarioAnswerRepository;
import com.viettel.campaign.repository.ccms_full.ScenarioQuestionRepository;
import com.viettel.campaign.repository.ccms_full.ScenarioRepository;
import com.viettel.campaign.repository.ccms_full.*;
import com.viettel.campaign.service.ScenarioService;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioAnswerDTO;
import com.viettel.campaign.web.dto.ScenarioDTO;
import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
import com.viettel.campaign.web.dto.*;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Date;
......@@ -46,6 +41,9 @@ public class ScenarioServiceImpl implements ScenarioService {
@Autowired
ModelMapper modelMapper;
@Autowired
ContactQuestResultRepository questResultRepository;
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Scenario findScenarioByCampaignIdAndCompanySiteId(Long campaignId, Long companySiteId) {
......@@ -116,4 +114,21 @@ public class ScenarioServiceImpl implements ScenarioService {
}
return resultDTO;
}
@Override
public ResultDTO saveContacQuestResult(ContactQuestResultDTO dto) {
ResultDTO resultDTO = new ResultDTO();
if (dto != null) {
ContactQuestResult cqr = questResultRepository.save(modelMapper.map(dto, ContactQuestResult.class));
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setData(cqr);
} else {
resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
}
return resultDTO;
}
}
......@@ -2,6 +2,7 @@ package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.Scenario;
import com.viettel.campaign.service.ScenarioService;
import com.viettel.campaign.web.dto.ContactQuestResultDTO;
import com.viettel.campaign.web.dto.ResultDTO;
import com.viettel.campaign.web.dto.ScenarioDTO;
import org.slf4j.Logger;
......@@ -19,11 +20,13 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping("/ipcc/campaign/scenario")
@CrossOrigin
public class ScenarioController {
private static final Logger logger = LoggerFactory.getLogger(ScenarioController.class);
@Autowired
ScenarioService scenarioService;
@RequestMapping(value="/findOneByCampaignIdAndCompanyId", method = RequestMethod.GET)
@RequestMapping(value = "/findOneByCampaignIdAndCompanyId", method = RequestMethod.GET)
Scenario findOneByCampaignIdAndCompanyId(@RequestParam Long campaignId, @RequestParam Long companySiteId) {
return scenarioService.findScenarioByCampaignIdAndCompanySiteId(campaignId, companySiteId);
}
......@@ -39,4 +42,10 @@ public class ScenarioController {
ResultDTO resultDTO = scenarioService.sortQuestionAndAnswer(scenarioDTO);
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@RequestMapping(value = "/saveContactQuestResult", method = RequestMethod.POST)
ResponseEntity<ResultDTO> saveContactQuestResult(@RequestBody ContactQuestResultDTO dto) {
ResultDTO resultDTO = scenarioService.saveContacQuestResult(dto);
return new ResponseEntity<>(resultDTO, 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