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

anhvd commit scenario services

parents e09dc598 1dff9662
[main] 19/08/2019 17:50:53 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 19/08/2019 17:53:34 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 15:54:32 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 15:57:26 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 15:59:04 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 16:01:09 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 16:54:17 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 17:01:34 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 17:06:33 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 17:45:13 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 22:29:55 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 21/08/2019 22:31:17 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 22/08/2019 08:36:29 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 22/08/2019 09:37:28 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 22/08/2019 10:56:57 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 22/08/2019 11:26:26 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 22/08/2019 11:38:32 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
[main] 22/08/2019 12:57:40 INFO RedisUtil: (38) : Start connect Redis: 10.60.156.82:8011,10.60.156.82:8012,10.60.156.82:8013,10.60.156.82:8014,10.60.156.82:8015,10.60.156.82:8016
......@@ -9,4 +9,6 @@ import com.viettel.campaign.web.dto.ScenarioQuestionDTO;
public interface ScenarioQuestionRepositoryCustom {
Integer countDuplicateQuestionCode(ScenarioQuestionDTO questionDTO);
Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO);
}
......@@ -68,6 +68,61 @@ public class ScenarioQuestionRepositoryImpl implements ScenarioQuestionRepositor
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
session.close();
}
return count;
}
@Override
public Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO) {
logger.info("Start search duplicate order index::");
SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
Session session = sessionFactory.openSession();
session.beginTransaction();
Integer count = null;
try {
StringBuilder sb = new StringBuilder();
sb.append("SELECT COUNT(1) FROM SCENARIO_QUESTION WHERE 1 = 1 AND STATUS = 1 ");
if (questionDTO.getScenarioQuestionId() != null) {
sb.append(" AND SCENARIO_QUESTION_ID <> :p_question_id ");
}
if (questionDTO.getOrderIndex() != null) {
sb.append(" AND ORDER_INDEX = :p_orderIndex ");
}
if (questionDTO.getCampaignId() != null) {
sb.append(" AND CAMPAIGN_ID = :p_campaign_id");
}
if (questionDTO.getCompanySiteId() != null) {
sb.append(" AND COMPANY_SITE_ID = :p_site_id");
}
SQLQuery query = session.createSQLQuery(sb.toString());
if (questionDTO.getScenarioQuestionId() != null) {
query.setParameter("p_question_id", questionDTO.getScenarioQuestionId());
}
if (questionDTO.getOrderIndex() != null) {
query.setParameter("p_orderIndex", questionDTO.getOrderIndex());
}
if (questionDTO.getCampaignId() != null) {
query.setParameter("p_campaign_id", questionDTO.getCampaignId());
}
if (questionDTO.getCompanySiteId() != null) {
query.setParameter("p_site_id", questionDTO.getCompanySiteId());
}
final List<BigDecimal> obj = query.list();
for (BigDecimal i : obj) {
if (i != null) {
count = i.intValue();
}
}
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
} finally {
session.close();
}
return count;
}
......
......@@ -20,4 +20,6 @@ public interface ScenarioQuestionService {
ResultDTO update(ScenarioQuestionDTO scenarioQuestionDTO);
Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO);
}
......@@ -898,18 +898,6 @@ public class CustomerServiceImpl implements CustomerService {
//<editor-fold desc="Khởi tạo mảng header tĩnh" defaultstate="collapsed">
List<CustomizeFields> header = new ArrayList<>();
// header.add(new CustomizeFields("text", "STT"));
// header.add(new CustomizeFields("text", "Họ và tên#Bắt buộc\nĐịnh dạng chữ\ntối đa 1000 ký tự"));
// header.add(new CustomizeFields("text", "Số điện thoại chính#Định dạng số\ncho phép nhập nhiều số điện thoại chính\ncác số cách nhau bởi dấu chấm phấy hoặc dấu phẩy\ntối đa 50 ký tự"));
// header.add(new CustomizeFields("text", "Số điện thoại phụ#Định dạng số\ncho phép nhập nhiều số điện thoại phụ\ncác số cách nhau bởi dấu chấm phấy hoặc dấu phẩy\ntối đa 50 ký tự"));
// header.add(new CustomizeFields("text", "Email chính#Cho phép nhập nhiều email\nmỗi email cách nhau bởi dấu \",\"\ntối đa 100 ký tự"));
// header.add(new CustomizeFields("text", "Địa chỉ#Tối đa 500 ký tự"));
// header.add(new CustomizeFields("combobox", "Loại khách hàng"));
// header.add(new CustomizeFields("text", "Công ty#Tối đa 100 ký tự"));
// header.add(new CustomizeFields("text", "Ghi chú#Tối đa 2000 ký tự"));
// header.add(new CustomizeFields("combobox", "Cho phép gọi ra"));
// header.add(new CustomizeFields("combobox", "Cho phép gửi email"));
// header.add(new CustomizeFields("combobox", "Cho phép gửi sms"));
header.add(new CustomizeFields("text", BundleUtils.getLangString("customer.no", locale)));
header.add(new CustomizeFields("text", BundleUtils.getLangString("customer.fullname", locale)));
header.add(new CustomizeFields("text", BundleUtils.getLangString("customer.mainPhone", locale)));
......@@ -1278,18 +1266,6 @@ public class CustomerServiceImpl implements CustomerService {
//<editor-fold desc="Tạo array header" defaultstate="collapsed">
List<CustomizeFields> header = new ArrayList<>();
// header.add(new CustomizeFields("text", "STT"));
// header.add(new CustomizeFields("text", "Họ và tên#Bắt buộc\nĐịnh dạng chữ\ntối đa 1000 ký tự"));
// header.add(new CustomizeFields("text", "Số điện thoại chính#Định dạng số\ncho phép nhập nhiều số điện thoại chính\ncác số cách nhau bởi dấu chấm phấy hoặc dấu phẩy\ntối đa 50 ký tự"));
// header.add(new CustomizeFields("text", "Số điện thoại phụ#Định dạng số\ncho phép nhập nhiều số điện thoại phụ\ncác số cách nhau bởi dấu chấm phấy hoặc dấu phẩy\ntối đa 50 ký tự"));
// header.add(new CustomizeFields("text", "Email chính#Cho phép nhập nhiều email\nmỗi email cách nhau bởi dấu \",\"\ntối đa 100 ký tự"));
// header.add(new CustomizeFields("text", "Địa chỉ#Tối đa 500 ký tự"));
// header.add(new CustomizeFields("combobox", "Loại khách hàng"));
// header.add(new CustomizeFields("text", "Công ty#Tối đa 100 ký tự"));
// header.add(new CustomizeFields("text", "Ghi chú#Tối đa 2000 ký tự"));
// header.add(new CustomizeFields("combobox", "Cho phép gọi ra"));
// header.add(new CustomizeFields("combobox", "Cho phép gửi email"));
// header.add(new CustomizeFields("combobox", "Cho phép gửi sms"));
header.add(new CustomizeFields("text", BundleUtils.getLangString("customer.no", locale)));
header.add(new CustomizeFields("text", BundleUtils.getLangString("customer.fullname", locale)));
header.add(new CustomizeFields("text", BundleUtils.getLangString("customer.mainPhone", locale)));
......
......@@ -302,4 +302,15 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
return resultDTO;
}
@Override
@Transactional(DataSourceQualify.CCMS_FULL)
public Integer countDuplicateOrderIndex(ScenarioQuestionDTO questionDTO) {
try {
return questionRepositoryCustom.countDuplicateOrderIndex(questionDTO);
} catch (Exception ex) {
logger.error(ex.getMessage(), ex);
}
return null;
}
}
......@@ -11,7 +11,6 @@ import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.econtact.filter.UserSession;
import org.apache.commons.io.FilenameUtils;
import org.eclipse.jetty.server.Authentication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -29,10 +28,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.*;
@Controller
@RequestMapping("/ipcc/customer")
......@@ -191,13 +187,14 @@ public class CustomerController {
@RequestParam("customerListId") Long customerListId,
@RequestHeader("X-Auth-Token") String authToken) {
LOGGER.info("------------IMPORT FILE TEMPLATE--------------");
Locale locale = new Locale("vi", "VN");
try {
UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken);
if (file.isEmpty()) {
return new ResponseEntity<>("Please select a file", HttpStatus.OK);
return new ResponseEntity<>(BundleUtils.getLangString("customer.fileNotSelected"), HttpStatus.OK);
}
if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
return new ResponseEntity<>("File khong dung dinh dang", HttpStatus.OK);
return new ResponseEntity<>(BundleUtils.getLangString("customer.invalidTemplate", locale), HttpStatus.OK);
}
String path = saveUploadFile(file);
List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
......
......@@ -56,4 +56,9 @@ public class ScenarioQuestionController {
return new ResponseEntity<>(resultDTO, HttpStatus.OK);
}
@RequestMapping(value = "/count-duplicate-order-index", method = RequestMethod.POST)
public Integer countDuplicateOrderIndex(@RequestBody ScenarioQuestionDTO questionDTO) {
return scenarioQuestionService.countDuplicateOrderIndex(questionDTO);
}
}
......@@ -102,3 +102,4 @@ customer.notGreaterThan = not greater than
customer.notLessThan = not less than
customer.importCustomer = IMPORT CUSTOMER
customer.notice = Attention: A record is valid when Full Name is not null and one of three fields Main phone, secondary phone or email is not null
customer.fileNotSelected=Please select a file
......@@ -75,7 +75,7 @@ customer.no = STT
customer.fullname = Họ và tên#Bắt buộc\nĐịnh dạng chữ\ntối đa 1000 kí tự
customer.mainPhone = Số điện thoại chính#Định dạng số\ncho phép nhập nhiều số điện thoại chính\ncác số cách nhau bởi dấu chấm phấy\ntối đa 50 ký tự
customer.secondPhone = Số điện thoại phụ#Định dạng số\ncho phép nhập nhiều số điện thoại phụ\ncác số cách nhau bởi dấu chấm phấy hoặc dấu phẩy\ntối đa 50 ký tự
customer.email = Email chính#Cho phép nhập nhiều email\nmỗi email cách nhau bởi dấu \";\"\ntối đa 100 ký tự
customer.email=Email#Cho phép nhập nhiều email\nmỗi email cách nhau bởi dấu \";\"\ntối đa 100 ký tự
customer.address = Địa chỉ#Tối đa 500 ký tự
customer.cusType = Loại khách hàng
customer.companyName = Công ty#Tối đa 100 ký tự
......@@ -104,3 +104,4 @@ customer.notGreaterThan = không được lớn hơn
customer.notLessThan = không được nhỏ hơn
customer.importCustomer = IMPORT KHÁCH HÀNG
customer.notice = Chú ý: 1 bản ghi được coi là hợp lệ bắt buộc phải có thông tin Họ và Tên và 1 trong 3 thông tin liên lạc (số điện thoại chính, số điện thoại phụ hoặc email)
customer.fileNotSelected=Bạn chưa chọn file
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