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

quangdn

parent 01f97d3a
...@@ -5,15 +5,18 @@ import lombok.Setter; ...@@ -5,15 +5,18 @@ import lombok.Setter;
import javax.persistence.*; import javax.persistence.*;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Entity @Entity
@Table(name = "CUSTOMER_CONTACT") @Table(name = "CUSTOMER_CONTACT")
@Getter @Getter
@Setter @Setter
public class CustomerContact { public class CustomerContact implements Serializable {
@Id @Id
@Basic(optional = false) @Basic(optional = false)
@GeneratedValue(generator = "customer_contact_seq", strategy = GenerationType.IDENTITY)
@SequenceGenerator(name = "customer_contact_seq", sequenceName = "customer_contact_seq", allocationSize = 1)
@NotNull @NotNull
@Column(name = "CONTACT_ID") @Column(name = "CONTACT_ID")
private Long contactId; private Long contactId;
......
...@@ -12,5 +12,5 @@ public interface CustomerContactRepository extends JpaRepository<CustomerContact ...@@ -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, '%')))") @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); 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 { ...@@ -33,7 +33,7 @@ public interface CustomerService {
ResultDTO getAllCustomerList(int page, int pageSize, String sort, Long companySiteId); 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); ResultDTO updateCustomerList(CustomerListDTO customerListDTO);
......
package com.viettel.campaign.web.rest; 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.CustomizeFieldObject;
import com.viettel.campaign.model.ccms_full.CustomizeFields; import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.service.CustomerService; import com.viettel.campaign.service.CustomerService;
...@@ -103,15 +104,15 @@ public class CustomerController { ...@@ -103,15 +104,15 @@ public class CustomerController {
} }
@PostMapping("/createCustomerList") @PostMapping("/createCustomerList")
@ResponseBody public ResponseEntity<?> createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) {
public ResultDTO createCustomerList(@RequestBody @Valid CustomerListDTO customerListDTO, HttpServletRequest request) {
ResultDTO result = new ResultDTO();
String xAuthToken = request.getHeader("X-Auth-Token"); String xAuthToken = request.getHeader("X-Auth-Token");
UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken); UserSession userSession = (UserSession) RedisUtil.getInstance().get(xAuthToken);
result = customerService.createCustomerList(customerListDTO, userSession.getUserName()); CustomerList cl = customerService.createCustomerList(customerListDTO, userSession.getUserName());
return result; if (cl == null) {
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
}
return new ResponseEntity<>(cl, HttpStatus.OK);
} }
@PostMapping("/updateCustomerList") @PostMapping("/updateCustomerList")
...@@ -185,11 +186,11 @@ public class CustomerController { ...@@ -185,11 +186,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("customerListId") Long customerListId, @RequestParam("customerListId") Long customerListId,
@RequestHeader("X-Auth-Token") String authToken) { HttpServletRequest request) {
LOGGER.info("------------IMPORT FILE TEMPLATE--------------"); LOGGER.info("------------IMPORT FILE TEMPLATE--------------");
Locale locale = new Locale("vi", "VN"); Locale locale = new Locale("vi", "VN");
try { try {
UserSession userSession = (UserSession) RedisUtil.getInstance().get(authToken); UserSession userSession = (UserSession) RedisUtil.getInstance().get(request.getHeader("X-Auth-Token"));
if (file.isEmpty()) { if (file.isEmpty()) {
return new ResponseEntity<>(BundleUtils.getLangString("customer.fileNotSelected"), HttpStatus.OK); return new ResponseEntity<>(BundleUtils.getLangString("customer.fileNotSelected"), HttpStatus.OK);
} }
......
...@@ -103,6 +103,8 @@ customer.notLessThan = not less than ...@@ -103,6 +103,8 @@ customer.notLessThan = not less than
customer.importCustomer = IMPORT CUSTOMER 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.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.fileNotSelected=Please select a file
customer.emailInvalid=Invalid email;
customer.emailExists=Email exists;
common.fileNotSelected=Please select a file common.fileNotSelected=Please select a file
common.fileInvalidFormat=File invalid common.fileInvalidFormat=File invalid
...@@ -105,6 +105,8 @@ customer.notLessThan = không được nhỏ hơn ...@@ -105,6 +105,8 @@ customer.notLessThan = không được nhỏ hơn
customer.importCustomer = IMPORT KHÁCH HÀNG 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.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.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.fileNotSelected=Bạn chưa chọn file
common.fileInvalidFormat=File không hợp lệ 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