Commit 0020d583 authored by ='s avatar =

hungtt-commit get data combobox field

parent 43c9a614
...@@ -91,6 +91,8 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom ...@@ -91,6 +91,8 @@ public interface CampaignCustomerRepository extends JpaRepository<CampaignCustom
CampaignCustomer findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(Long campaignId, Long companySiteId, Long customerId); CampaignCustomer findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(Long campaignId, Long companySiteId, Long customerId);
List<CampaignCustomer> findCampaignCustomersByCampaignIdAndCompanySiteIdAndCustomerIdAndInCampaignStatus(Long campaignId, Long companySiteId, Long customerId, Long inCampaingStatus);
@Query(value = "select complete_value from campaign_complete_code where status = 1 and is_finish = 0 and is_recall = 0", nativeQuery = true) @Query(value = "select complete_value from campaign_complete_code where status = 1 and is_finish = 0 and is_recall = 0", nativeQuery = true)
List<Short> getStatus(); List<Short> getStatus();
} }
...@@ -1653,12 +1653,14 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1653,12 +1653,14 @@ public class CustomerServiceImpl implements CustomerService {
List<Short> lstStatus = campaignCustomerRepository.getStatus(); List<Short> lstStatus = campaignCustomerRepository.getStatus();
try { try {
for (String cusId : lstCusId) { for (String cusId : lstCusId) {
CampaignCustomer entity = campaignCustomerRepository.findCampaignCustomerByCampaignIdAndCompanySiteIdAndCustomerId(campaignId, companySiteId, Long.parseLong(cusId)); List<CampaignCustomer> listEntity = campaignCustomerRepository.findCampaignCustomersByCampaignIdAndCompanySiteIdAndCustomerIdAndInCampaignStatus(campaignId, companySiteId, Long.parseLong(cusId), 1L);
if (entity.getStatus() == 0) { for (CampaignCustomer entity : listEntity) {
campaignCustomerRepository.delete(entity); if (entity.getStatus() == 0) {
} else if (lstStatus.contains(entity.getStatus())) { campaignCustomerRepository.delete(entity);
entity.setInCampaignStatus((short) 0); } else if (lstStatus.contains(entity.getStatus())) {
campaignCustomerRepository.save(entity); entity.setInCampaignStatus((short) 0);
campaignCustomerRepository.save(entity);
}
} }
} }
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS); resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
......
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