Commit 17f6c980 authored by Vu Duy Anh's avatar Vu Duy Anh

anhvd accetp merge

parents 9a32f07d 38eaf724
......@@ -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 findCustomerContactByContactEquals(String contact);
List<CustomerContact> findCustomerContactsByContactEquals(String contact);
}
......@@ -39,6 +39,6 @@ public interface CustomerRepository extends JpaRepository<Customer, Long> {
@Query(value = "select * from customer a\n" +
"left join customer_list_mapping b on a.customer_id = b.customer_id\n" +
"where b.customer_list_id = :p_customer_list_id\n" +
" and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id)", nativeQuery = true)
" and a.customer_id not in (select cc.customer_id from campaign_customer cc where cc.campaign_id = :p_campaign_id and cc.customer_list_id = :p_customer_list_id and cc.in_campaign_status <> 0)", nativeQuery = true)
List<Customer> findAllCutomerNotInCampagin(@Param("p_customer_list_id") Long customerListId, @Param("p_campaign_id") Long campaignId);
}
......@@ -621,12 +621,12 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"),\n" +
"campaign_customer_table as (\n" +
" select count(a.customer_id) campaignCustomer, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.campaign_id = :p_campaign_id\n" +
" where a.campaign_id = :p_campaign_id and in_campaign_status = 1\n" +
" group by a.customer_list_id, a.campaign_id\n" +
"),\n" +
"customer_interactive_table as (\n" +
" select count(a.customer_id) campaignCustomerCalled, a.customer_list_id customerListId, a.campaign_id from campaign_customer a\n" +
" where a.status <> 0 and a.campaign_id = :p_campaign_id\n" +
" where a.status <> 0 and a.campaign_id = :p_campaign_id and in_campaign_status = 1\n" +
" group by a.customer_list_id, a.campaign_id\n" +
"),\n" +
"customer_not_interactive_table as (\n" +
......
......@@ -640,9 +640,15 @@ public class CampaignServiceImpl implements CampaignService {
if (customerListDTO.getTotalCusAddRemove() > 0) { // Them khach hang
// Lay ra danh sach khach hang phu hop de them
List<Customer> listCustomerToAdd = customerRepository.findAllCutomerNotInCampagin(customerListDTO.getCustomerListId(), campaignId);
int numOfCusInList = listCustomerToAdd.size(); // Số khách hàng còn lại của chiến dịch chưa đc add vào campaign
int numOfCusInList = listCustomerToAdd.size(); // Số khách hàng còn lại của chiến dịch chưa đc add vào campaign hoặc đã add nhưng in_campaign_status = 0
for (int i = 0, j = 0; (i < customerListDTO.getTotalCusAddRemove() && j < numOfCusInList); j++) {
if (campaignCustomerRepository.findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(campaignId, companySiteId, listCustomerToAdd.get(j).getCustomerId()) != null) { // Khach hang đã đc chèn vào campaign theo individual
CampaignCustomer tempEntity = campaignCustomerRepository.findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(campaignId, companySiteId, listCustomerToAdd.get(j).getCustomerId());
if (tempEntity != null) { // Khach hang đã đc chèn vào campaign theo individual / hoặc in_campaign_status = 0
if ((tempEntity.getCustomerListId() == customerListDTO.getCustomerListId()) && tempEntity.getInCampaignStatus() == 0) {
tempEntity.setInCampaignStatus((short) 1);
campaignCustomerRepository.save(tempEntity);
i+=1;
}
continue;
} else {
CampaignCustomer campaignCustomerEntity = new CampaignCustomer();
......
......@@ -6,7 +6,6 @@ import com.viettel.campaign.model.ccms_full.CustomizeFields;
import com.viettel.campaign.repository.ccms_full.CustomerQueryRepository;
import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.utils.Config;
import com.viettel.campaign.utils.Constants;
import com.viettel.campaign.utils.RedisUtil;
import com.viettel.campaign.web.dto.*;
import com.viettel.campaign.web.dto.request_dto.CustomerRequestDTO;
......@@ -33,7 +32,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Controller
@RequestMapping("/ipcc/customer")
......@@ -202,9 +200,9 @@ public class CustomerController {
if (file.isEmpty()) {
return new ResponseEntity<>("file-empty", HttpStatus.OK);
}
if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
return new ResponseEntity<>("template-invalid", HttpStatus.OK);
}
// if (!Objects.equals(FilenameUtils.getExtension(file.getOriginalFilename()), Constants.FileType.xlsx)) {
// return new ResponseEntity<>("template-invalid", HttpStatus.OK);
// }
String path = saveUploadFile(file);
List<CustomizeFields> dynamicHeaders = customerService.getDynamicHeader(userSession.getCompanySiteId());
Map<String, Object> map = customerService.readAndValidateCustomer(path, dynamicHeaders, userSession, Long.parseLong(customerListId));
......
......@@ -90,7 +90,6 @@ customer.not = No
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
......
......@@ -92,7 +92,9 @@ customer.not = Khô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.mainPhoneRequired=Số điện thoại chính không được để trống
customer.secondPhoneRequired=Số điện thoại phụ không được để trống
customer.emailRequired=Số điện thoại 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
......
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