Commit bf2e747e authored by Đào Nhật Quang's avatar Đào Nhật Quang

quangdn

parent 4b201f38
...@@ -7,6 +7,7 @@ import com.viettel.campaign.model.ccms_full.CustomizeFields; ...@@ -7,6 +7,7 @@ import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.web.dto.*; import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO; import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO; import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.econtact.filter.UserSession;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -66,7 +67,7 @@ public interface CustomerService { ...@@ -66,7 +67,7 @@ public interface CustomerService {
byte[] buildTemplate(Long companySiteId); byte[] buildTemplate(Long companySiteId);
Map<String, Object> readAndValidateCustomer(String path, List<CustomizeFields> headerDTOS, Long companySiteId); Map<String, Object> readAndValidateCustomer(String path, List<CustomizeFields> headerDTOS, UserSession userSession, Long customerListId);
List<CustomizeFieldObject> getCustomizeField(Long customerId); List<CustomizeFieldObject> getCustomizeField(Long customerId);
} }
...@@ -11,6 +11,7 @@ import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO; ...@@ -11,6 +11,7 @@ import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO; import com.viettel.campaign.web.dto.request_dto.SearchCustomerRequestDTO;
import com.viettel.econtact.filter.UserSession; import com.viettel.econtact.filter.UserSession;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.eclipse.jetty.server.Authentication;
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;
...@@ -187,11 +188,11 @@ public class CustomerController { ...@@ -187,11 +188,11 @@ public class CustomerController {
@PostMapping(value = "/importFile") @PostMapping(value = "/importFile")
public ResponseEntity<?> importFile(@RequestParam("file") MultipartFile file, public ResponseEntity<?> importFile(@RequestParam("file") MultipartFile file,
@RequestParam("companySiteId") Long companySiteId, @RequestParam("customerListId") Long customerListId,
@RequestHeader("X-Auth-Token") String authToken) { @RequestHeader("X-Auth-Token") String authToken) {
LOGGER.info("------------IMPORT FILE TEMPLATE--------------"); LOGGER.info("------------IMPORT FILE TEMPLATE--------------");
try { try {
// UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken); UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken);
if (file.isEmpty()) { if (file.isEmpty()) {
return new ResponseEntity<>("Please select a file", HttpStatus.OK); return new ResponseEntity<>("Please select a file", HttpStatus.OK);
} }
...@@ -199,8 +200,8 @@ public class CustomerController { ...@@ -199,8 +200,8 @@ public class CustomerController {
return new ResponseEntity<>("File khong dung dinh dang", HttpStatus.OK); return new ResponseEntity<>("File khong dung dinh dang", HttpStatus.OK);
} }
String path = saveUploadFile(file); String path = saveUploadFile(file);
List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(companySiteId); List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, companySiteId); Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, customerListId);
File fileExport = (File) map.get("file"); File fileExport = (File) map.get("file");
String message = (String) map.get("message"); String message = (String) map.get("message");
return ResponseEntity.ok() return ResponseEntity.ok()
......
...@@ -67,3 +67,38 @@ IPCC_STATUS = IPCC_STATUS ...@@ -67,3 +67,38 @@ IPCC_STATUS = IPCC_STATUS
EMAIL = EMAIL EMAIL = EMAIL
CUSTOMER_TYPE = CUSTOMER_TYPE CUSTOMER_TYPE = CUSTOMER_TYPE
AVATAR_LINK = AVATAR_LINK AVATAR_LINK = AVATAR_LINK
#Customer Excel Header
customer.no = No
customer.fullname = Full Name#Required\nLetters only\nmaximum 1000 characters
customer.mainPhone = Main mobile phone#Number only\nmultiple numbers allowed\neach seperate by semicolon\nmaximum 50 characters
customer.secondPhone = Secondary phone#Number only\nmultiple numbers allowed\neach seperate by semicolon\nmaximum 50 characters
customer.email = Email#multiple emails allowed\neach seperate by semicolon\nmaximum 100 characters
customer.address = Address#maximum 500 characters
customer.cusType = Customer Type
customer.companyName = Company#maximum 100 characters
customer.description = Description#maximum 2000 characters
customer.callAllowed = Call Allowed
customer.emailAllowed = Email Allowed
customer.smsAllowed = Sms Allowed
customer.result = Result
customer.cusType.normal = Normal
customer.cusType.vip = VIP
customer.cusType.blacklist = Blacklist
customer.yes = Yes
customer.not = No
customer.invalidTemplate = Invalid Template
customer.noData = Template empty
customer.nameRequired = Full name required;
customer.emailMax50 = Email must less than 50 character;
customer.invalidCustomer = All 3 fields Main phone, second phone and email must not null;
customer.importSuccess = Import Successful
customer.importFailed = Import Failed
customer.errorValidate = Error while validating
customer.phoneMax50 = Mobile phone must less than 50 character;
customer.phoneExists = Mobile phone exists;
customer.notMatch = not match regexp validation
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
...@@ -69,3 +69,38 @@ IPCC_STATUS = IPCC_STATUS ...@@ -69,3 +69,38 @@ IPCC_STATUS = IPCC_STATUS
EMAIL = EMAIL EMAIL = EMAIL
CUSTOMER_TYPE = CUSTOMER_TYPE CUSTOMER_TYPE = CUSTOMER_TYPE
AVATAR_LINK = AVATAR_LINK AVATAR_LINK = AVATAR_LINK
#Customer Excel Header
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.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ự
customer.description = Ghi chú#Tối đa 2000 ký tự
customer.callAllowed = Cho phép gọi ra
customer.emailAllowed = Cho phép gửi email
customer.smsAllowed = Cho phép gửi sms
customer.result = Kết quả
customer.cusType.normal = Thường
customer.cusType.vip = VIP
customer.cusType.blacklist = Blacklist
customer.yes =
customer.not = Không
customer.invalidTemplate = Template sai định dạng
customer.noData = Template không có dữ liệu
customer.nameRequired = Họ và tên không được để trống;
customer.emailMax50 = Email không được quá 50 kí tự;
customer.invalidCustomer = Cả 3 thông tin số điện thoại chính, số điện phụ và email không được để trống;
customer.importSuccess = Import dữ liệu thành công
customer.importFailed = Import dữ liệu thất bại
customer.errorValidate = Validate dữ liệu lỗi
customer.phoneMax50 = Số điện thoại không được quá 50 kí tự;
customer.phoneExists = Số điện thoại chính đã tồn tại;
customer.notMatch = không đúng định dạng
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)
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