Commit ba5f20e1 authored by Vu Duy Anh's avatar Vu Duy Anh

anhvd change source scenario update

parent d633103b
......@@ -28,7 +28,7 @@ public interface ScenarioService {
XSSFWorkbook buildTemplate() throws IOException;
Map<String, Object> readAndValidateCustomer(String path, Long scenarioId, Long campaignId, Long companySiteId) throws IOException;
Map<String, Object> readAndValidateScenario(String path, Long scenarioId, Long campaignId, Long companySiteId) throws IOException;
List<ContactQuestResult> getContactQuestResult(Long companySiteId, Long campaignId, Long customerId);
}
......@@ -80,7 +80,6 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
if (scenarioQuestionDTO.getLstAnswers().size() > 0) {
lstAnswers = scenarioQuestionDTO.getLstAnswers();
lstAnswers.forEach(item -> {
item.setCode(scenarioQuestion.getCode() + "_" + item.getOrderIndex());
item.setScenarioQuestionId(scenarioQuestion.getScenarioQuestionId());
item.setCreateTime(new Date());
item.setStatus((short) 1);
......
......@@ -254,7 +254,7 @@ public class ScenarioServiceImpl implements ScenarioService {
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Map<String, Object> readAndValidateCustomer (String path, Long scenarioId, Long campaignId, Long companySiteId) throws IOException{
public Map<String, Object> readAndValidateScenario (String path, Long scenarioId, Long campaignId, Long companySiteId) throws IOException{
Locale locale = new Locale("vi", "VN");
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
Map<String, Object> result = new HashMap<>();
......@@ -551,6 +551,7 @@ public class ScenarioServiceImpl implements ScenarioService {
lstQuestions.forEach(q2 -> {
List<ScenarioAnswerDTO> lstAnswers = q2.getLstAnswers();
lstAnswers.forEach(a2 -> {
a2.setCode(q2.getCode() + "_" + a2.getOrderIndex());
ScenarioQuestionDTO mappingQuestion = lstQuestions.stream().filter(mq -> mq.getImportCode().equals(a2.getMappingQuestionCode())).findFirst().orElse(null);
if (mappingQuestion != null) {
a2.setMappingQuestionCode(mappingQuestion.getCode());
......
......@@ -118,7 +118,7 @@ public class ScenarioController {
return new ResponseEntity<>(BundleUtils.getLangString("common.fileInvalidFormat", locale), HttpStatus.OK);
}
String path = saveUploadFile(file);
Map<String, Object> map = scenarioService.readAndValidateCustomer(path, scenarioId, campaignId, userSession.getCompanySiteId());
Map<String, Object> map = scenarioService.readAndValidateScenario(path, scenarioId, campaignId, userSession.getCompanySiteId());
String code = (String) map.get("code");
byte[] content = (byte[]) map.get("content");
return ResponseEntity.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