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

quangdn

parent 01f97d3a
......@@ -5,15 +5,18 @@ import lombok.Setter;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "CUSTOMER_CONTACT")
@Getter
@Setter
public class CustomerContact {
public class CustomerContact implements Serializable {
@Id
@Basic(optional = false)
@GeneratedValue(generator = "customer_contact_seq", strategy = GenerationType.IDENTITY)
@SequenceGenerator(name = "customer_contact_seq", sequenceName = "customer_contact_seq", allocationSize = 1)
@NotNull
@Column(name = "CONTACT_ID")
private Long contactId;
......
......@@ -12,5 +12,5 @@ public interface CustomerContactRepository extends JpaRepository<CustomerContact
@Query("FROM CustomerContact WHERE status = 1 AND customerId = :customerId AND contactType = :contactType AND (contact IS NULL OR UPPER(contact) LIKE UPPER(concat('%', :contact, '%')))")
List<CustomerContact> findByCustomerIdAndAndContactTypeAndContact(@Param("customerId") Long customerId, @Param("contactType") Short contactType, @Param("contact") String contact, Pageable pageable);
CustomerContact findCustomerContactByContactTypeAndContactAndIsDirectLine(Short contactType, String contact, Short isDirectLine);
CustomerContact findCustomerContactByContactEquals(String contact);
}
......@@ -33,7 +33,7 @@ public interface CustomerService {
ResultDTO getAllCustomerList(int page, int pageSize, String sort, Long companySiteId);
ResultDTO createCustomerList(CustomerListDTO customerListDTO, String userName);
CustomerList createCustomerList(CustomerListDTO customerListDTO, String userName);
ResultDTO updateCustomerList(CustomerListDTO customerListDTO);
......
package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.CustomerList;
import com.viettel.campaign.model.ccms_full.CustomizeFieldObject;
import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.service.CustomerService;
......@@ -103,15 +104,15 @@ public class CustomerController {
}
@PostMapping("/createCustomerList")
@ResponseBody
public ResultDTO createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) {
ResultDTO result = new ResultDTO();
public ResponseEntity<?> createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) {
String xAuthToken = request.getHeader("X-Auth-Token");
UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken);
result = customerService.createCustomerList(customerListDTO, userSession.getUserName());
return result;
CustomerList cl = customerService.createCustomerList(customerListDTO, userSession.getUserName());
if (cl == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(cl, HttpStatus.OK);
}
@PostMapping("/updateCustomerList")
......@@ -185,11 +186,11 @@ public class CustomerController {
@PostMapping(value = "/importFile")
public ResponseEntity<?> importFile(@RequestParam("file") MultipartFile file,
@RequestParam("customerListId") Long customerListId,
@RequestHeader("X-Auth-Token") String authToken) {
HttpServletRequest request) {
LOGGER.info("------------IMPORT FILE TEMPLATE--------------");
Locale locale = new Locale("vi", "VN");
try {
UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken);
UserSession userSession = (UserSession) RedisUtil.getInstance().get(request.getHeader("X-Auth-Token"));
if (file.isEmpty()) {
return new ResponseEntity<>(BundleUtils.getLangString("customer.fileNotSelected"), HttpStatus.OK);
}
......
......@@ -103,6 +103,8 @@ 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
customer.emailInvalid=Invalid email;
customer.emailExists=Email exists;
common.fileNotSelected=Please select a file
common.fileInvalidFormat=File invalid
......@@ -105,6 +105,8 @@ 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
customer.emailInvalid=Email không đúng định dạng;
customer.emailExists=Email đã tồn tại;
common.fileNotSelected=Bạn chưa chọn file
common.fileInvalidFormat=File không hợp lệ
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