Commit 36314183 authored by đinh thị đầm's avatar đinh thị đầm

Merge branch 'master' of http://git.myitsol.com/hanv/service-campaign

 Conflicts:
	src/main/java/com/viettel/campaign/service/impl/CustomerServiceImpl.java
parents 44ff1eae 7df84a02
...@@ -91,6 +91,6 @@ public interface CustomerService { ...@@ -91,6 +91,6 @@ public interface CustomerService {
//// List<CustomizeFields> searchCustomize(); //// List<CustomizeFields> searchCustomize();
ResultDTO listCustomizeFields(CustomizeFieldsDTO customizeFields); ResultDTO listCustomizeFields(CustomizeFieldsDTO customizeFields);
ResultDTO searchCustomizeFields(CampaignCustomerDTO campaignCustomerDTO); ResultDTO searchCustomizeFields(CampaignCustomerDTO campaignCustomerDTO, UserSession userSession);
} }
...@@ -831,7 +831,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -831,7 +831,7 @@ public class CustomerServiceImpl implements CustomerService {
sb.append(" AND a.STATUS = 1"); sb.append(" AND a.STATUS = 1");
sb.append(" AND a.COMPANY_SITE_ID = :p_company_site_id"); sb.append(" AND a.COMPANY_SITE_ID = :p_company_site_id");
sb.append(" AND CREATE_AT >= to_date(:p_date_from, 'DD/MM/YYYY HH24:MI:SS') AND CREATE_AT <= to_date(:p_date_to, 'DD/MM/YYYY HH24:MI:SS')"); sb.append(" AND to_date(CREATE_AT, 'DD/MM/RR') >= to_date(:p_date_from, 'DD/MM/YYYY HH24:MI:SS') AND to_date(CREATE_AT, 'DD/MM/RR') <= to_date(:p_date_to, 'DD/MM/YYYY HH24:MI:SS')");
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) { if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) {
sb.append(" AND UPPER(CUSTOMER_LIST_CODE) LIKE UPPER(:p_list_code)"); sb.append(" AND UPPER(CUSTOMER_LIST_CODE) LIKE UPPER(:p_list_code)");
...@@ -1072,7 +1072,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1072,7 +1072,7 @@ public class CustomerServiceImpl implements CustomerService {
//</editor-fold> //</editor-fold>
//<editor-fold desc="Đọc dữ liệu từng dòng 1" defaultstate="collapsed"> //<editor-fold desc="Đọc dữ liệu từng dòng 1" defaultstate="collapsed">
for (int i = 4; i <= sheet.getPhysicalNumberOfRows(); i++) { for (int i = 4; i < sheet.getPhysicalNumberOfRows(); i++) {
Row dataRow = sheet.getRow(i); Row dataRow = sheet.getRow(i);
if (!isRowEmpty(dataRow)) { if (!isRowEmpty(dataRow)) {
Object[] obj = new Object[objectSize + 1]; Object[] obj = new Object[objectSize + 1];
...@@ -1109,7 +1109,11 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1109,7 +1109,11 @@ public class CustomerServiceImpl implements CustomerService {
&& (rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])] == null || rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim().equals(""))) { && (rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])] == null || rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim().equals(""))) {
isMainPhoneNull = true; isMainPhoneNull = true;
} else { } else {
if (validateNumberOnly(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim())) { String str = validateLength(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0], rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString(), 50, locale);
if(!str.equals("")){
sb.append(str);
}
else if(validateNumberOnly(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim())) {
sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim(), locale, true)); sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.mainPhone", locale).split("#")[0])].toString().trim(), locale, true));
} else { } else {
sb.append(BundleUtils.getLangString("customer.onlyNumber", locale)); sb.append(BundleUtils.getLangString("customer.onlyNumber", locale));
...@@ -1118,7 +1122,11 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1118,7 +1122,11 @@ public class CustomerServiceImpl implements CustomerService {
if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0]) && (rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])] == null || rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim().equals(""))) { if (rawDataList.get(i).length > headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0]) && (rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])] == null || rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim().equals(""))) {
isSecondPhoneNull = true; isSecondPhoneNull = true;
} else { } else {
if (validateNumberOnly(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim())) { String str = validateLength(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0], rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString(), 50, locale);
if(!str.equals("")){
sb.append(str);
}
else if (validateNumberOnly(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString().trim())) {
sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString(), locale, false)); sb.append(validateExistPhone(rawDataList.get(i)[headerMap.get(BundleUtils.getLangString("customer.secondPhone", locale).split("#")[0])].toString(), locale, false));
} else { } else {
sb.append(BundleUtils.getLangString("customer.onlyNumber", locale)); sb.append(BundleUtils.getLangString("customer.onlyNumber", locale));
...@@ -2267,7 +2275,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -2267,7 +2275,7 @@ public class CustomerServiceImpl implements CustomerService {
@Override @Override
@Transactional(DataSourceQualify.CCMS_FULL) @Transactional(DataSourceQualify.CCMS_FULL)
public ResultDTO searchCustomizeFields(CampaignCustomerDTO campaignCustomerDTO) { public ResultDTO searchCustomizeFields(CampaignCustomerDTO campaignCustomerDTO, UserSession userSession) {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
SessionFactory sessionFactory = HibernateUtil.getSessionFactory(); SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
...@@ -2285,11 +2293,6 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -2285,11 +2293,6 @@ public class CustomerServiceImpl implements CustomerService {
requestCustomer.put("-9", "cc2.contact"); requestCustomer.put("-9", "cc2.contact");
requestCustomer.put("-10", "c.username"); requestCustomer.put("-10", "c.username");
requestCustomer.put("-11", "c.customer_type"); requestCustomer.put("-11", "c.customer_type");
requestCustomer.put("-12", "c.area_code");
requestCustomer.put("-13", "c.call_allowed");
requestCustomer.put("-14", "c.email_allowed");
requestCustomer.put("-15", "c.sms_allowed");
requestCustomer.put("-16", "c.ipcc_status");
try { try {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -2314,7 +2317,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -2314,7 +2317,7 @@ public class CustomerServiceImpl implements CustomerService {
sb.append(" left join customize_field_object cfo on c.customer_id = cfo.object_id and cfo.status = 1"); sb.append(" left join customize_field_object cfo on c.customer_id = cfo.object_id and cfo.status = 1");
sb.append(" AND C.STATUS = 1"); sb.append(" AND C.STATUS = 1");
sb.append(" AND C.customer_id not in (select customer_id from campaign_customer where campaign_id = :p_campaign_id) "); sb.append(" AND C.customer_id not in (select customer_id from campaign_customer where campaign_id = :p_campaign_id) ");
sb.append(" where 1 = 1 "); sb.append(" where 1 = 1 AND C.STATUS = 1 AND C.SITE_ID = :p_site_id ");
List<CustomerQueryDTO> customerDTOList = campaignCustomerDTO.getListQuery(); List<CustomerQueryDTO> customerDTOList = campaignCustomerDTO.getListQuery();
if (customerDTOList.get(0).getField() > 0) {// field dong if (customerDTOList.get(0).getField() > 0) {// field dong
...@@ -2437,6 +2440,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -2437,6 +2440,7 @@ public class CustomerServiceImpl implements CustomerService {
query.addScalar("description", new StringType()); query.addScalar("description", new StringType());
query.setParameter("p_campaign_id", campaignCustomerDTO.getCampaignId()); query.setParameter("p_campaign_id", campaignCustomerDTO.getCampaignId());
query.setParameter("p_site_id", userSession.getSiteId());
query.setResultTransformer(Transformers.aliasToBean(CustomerDTO.class)); query.setResultTransformer(Transformers.aliasToBean(CustomerDTO.class));
......
...@@ -80,7 +80,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService { ...@@ -80,7 +80,7 @@ public class ScenarioQuestionServiceImpl implements ScenarioQuestionService {
if (scenarioQuestionDTO.getLstAnswers().size() > 0) { if (scenarioQuestionDTO.getLstAnswers().size() > 0) {
lstAnswers = scenarioQuestionDTO.getLstAnswers(); lstAnswers = scenarioQuestionDTO.getLstAnswers();
lstAnswers.forEach(item -> { lstAnswers.forEach(item -> {
item.setCode(scenarioQuestion.getScenarioQuestionId() + "_" + item.getOrderIndex()); item.setCode(scenarioQuestion.getCode() + "_" + item.getOrderIndex());
item.setScenarioQuestionId(scenarioQuestion.getScenarioQuestionId()); item.setScenarioQuestionId(scenarioQuestion.getScenarioQuestionId());
item.setCreateTime(new Date()); item.setCreateTime(new Date());
item.setStatus((short) 1); item.setStatus((short) 1);
......
...@@ -310,8 +310,9 @@ public class CustomerController { ...@@ -310,8 +310,9 @@ public class CustomerController {
@PostMapping("/searchIndividualCustomer") @PostMapping("/searchIndividualCustomer")
@ResponseBody @ResponseBody
public ResponseEntity searchCustomizeFields(@RequestBody CampaignCustomerDTO campaignCustomerDTO) { public ResponseEntity searchCustomizeFields(@RequestBody CampaignCustomerDTO campaignCustomerDTO, HttpServletRequest request) {
ResultDTO result = customerService.searchCustomizeFields(campaignCustomerDTO); UserSession userSession = (UserSession) RedisUtil.getInstance().get(request.getHeader("X-Auth-Token"));
ResultDTO result = customerService.searchCustomizeFields(campaignCustomerDTO, userSession);
return new ResponseEntity<>(result, HttpStatus.OK); return new ResponseEntity<>(result, HttpStatus.OK);
} }
......
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