Commit ea662bf4 authored by ='s avatar =

Merge remote-tracking branch 'origin/master'

parents e4f8b465 f8bf5b8a
...@@ -1869,50 +1869,8 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1869,50 +1869,8 @@ public class CustomerServiceImpl implements CustomerService {
datafill.setCustomizeFieldId(Long.parseLong(cf[x][0])); datafill.setCustomizeFieldId(Long.parseLong(cf[x][0]));
datafill.setTitle(cf[x][1]); datafill.setTitle(cf[x][1]);
datafill.setType(cf[x][2]); datafill.setType(cf[x][2]);
lstCustomizeFields.add(datafill); lstCustomizeFields.add(datafill);
} }
// try {
// stringBuilder.append(" with column_name_temp as (");
// stringBuilder.append(" select 'CUSTOMER_ID customerId' , from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'CUSTOMER_NAME customerName' , from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'CUSTOMER_TYPE customerType' , from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'NAME name' , from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'CURRENT_ADDRESS currentAddress', from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'PLACE_OF_BIRTH placeOfBirth', from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'DATE_OF_BIRTH dateOfBirth', from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'MOBILE_NUMBER mobileNumber', from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'EMAIL email', from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'USERNAME username', from user_tab_columns, dual");
// stringBuilder.append(" union all");
// stringBuilder.append(" select 'CUSTOMER_TYPE customerType', from user_tab_columns, dual");
// stringBuilder.append(" where table_name = 'CUSTOMER'");
// stringBuilder.append(" )");
//
// stringBuilder.append(" select * from column_name_temp");
// stringBuilder.append(" union all");
// stringBuilder.append(" select title columnName, 0 isFix ");
// stringBuilder.append(" from customize_fields, dual");
// stringBuilder.append(" where function_code = 'CUSTOMER'");
// stringBuilder.append(" and site_id = :p_company_site_id");
// stringBuilder.append(" and STATUS = 1");
// stringBuilder.append(" and active = 1 ");
// params.put("p_company_site_id", customizeFields.getSiteId());
// params.put("p_customer_id", customizeFields.getCustomerId());
// LOGGER.info("SQL statement: " + stringBuilder);
// list = namedParameterJdbcTemplate.query(stringBuilder.toString(), params, BeanPropertyRowMapper.newInstance(CustomizeFielObjectDTO.class));
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS); resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS); resultDTO.setDescription(Constants.ApiErrorDesc.SUCCESS);
resultDTO.setListData(lstCustomizeFields); resultDTO.setListData(lstCustomizeFields);
...@@ -1935,12 +1893,6 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1935,12 +1893,6 @@ public class CustomerServiceImpl implements CustomerService {
Session session = sessionFactory.openSession(); Session session = sessionFactory.openSession();
session.beginTransaction(); session.beginTransaction();
// if (DataUtil.isNullOrZero(SiteId)) {
// resultDTO.setErrorCode(Constants.ApiErrorCode.ERROR);
// resultDTO.setDescription(Constants.ApiErrorDesc.ERROR);
// return resultDTO;
// }
try { try {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
...@@ -1964,9 +1916,9 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1964,9 +1916,9 @@ public class CustomerServiceImpl implements CustomerService {
sb.append(" FROM CUSTOMER C"); sb.append(" FROM CUSTOMER C");
sb.append(" INNER JOIN CUSTOMIZE_FIELD_OBJECT CFO ON C.CUSTOMER_ID = CFO.OBJECT_ID"); sb.append(" INNER JOIN CUSTOMIZE_FIELD_OBJECT CFO ON C.CUSTOMER_ID = CFO.OBJECT_ID");
sb.append(" INNER JOIN CUSTOMIZE_FIELDS CF ON CF.CUSTOMIZE_FIELD_ID = CFO.CUSTOMIZE_FIELDS_ID\n" + sb.append(" INNER JOIN CUSTOMIZE_FIELDS CF ON CF.CUSTOMIZE_FIELD_ID = CFO.CUSTOMIZE_FIELDS_ID\n" +
" WHERE 1 = 1"); " WHERE ");
sb.append(" AND CFO.STATUS = 1"); sb.append(" CFO.STATUS = 1");
sb.append(" AND ACTIVE = 1 "); sb.append(" AND CF.ACTIVE = 1 ");
sb.append(" AND CF.FUNCTION_CODE = 'CUSTOMER' "); sb.append(" AND CF.FUNCTION_CODE = 'CUSTOMER' ");
List<CustomerQueryDTO> customerDTOList = campaignCustomerDTO.getListQuery(); List<CustomerQueryDTO> customerDTOList = campaignCustomerDTO.getListQuery();
...@@ -1979,45 +1931,98 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1979,45 +1931,98 @@ public class CustomerServiceImpl implements CustomerService {
// + campaignCustomerDTO.getListQuery().get(i).getField() + " " // + campaignCustomerDTO.getListQuery().get(i).getField() + " "
// + campaignCustomerDTO.getListQuery().get(i).getOperator() + " " // + campaignCustomerDTO.getListQuery().get(i).getOperator() + " "
// + campaignCustomerDTO.getListQuery().get(i).getCondition() + " "); // + campaignCustomerDTO.getListQuery().get(i).getCondition() + " ");
for (CustomerQueryDTO query : customerDTOList) { // Map<String, String> requestCustomer = new HashMap<>();
// if (query.getJoin() == null) { // requestCustomer.put("-1" ,"Mã Khách Hàng");
// sb.append("AND "); // requestCustomer.put("-2" ,"Tên khách hàng");
// } else { // requestCustomer.put("-3" ,"Tên công ty");
// sb.append(query.getJoin() + " "); // requestCustomer.put("-4" ,"Giới tính");
// requestCustomer.put("-5" ,"Địa chỉ");
// requestCustomer.put("-6" ,"Nơi sinh");
// requestCustomer.put("-7" ,"Ngày sinh");
// requestCustomer.put("-8" ,"Số điện thoại");
// requestCustomer.put("-9" ,"email");
// requestCustomer.put("-10" ,"Tên đăng nhập");
// requestCustomer.put("-11" ,"Loại Khách hàng");
// sb.append("and "+customerDTOList.get(0).getField());
// for (int i = 1; i < customerDTOList.size(); i++) {
//
// } // }
// sb.append(query.getField() + " ");
// sb.append(query.getOperator() + " ");
for (CustomerQueryDTO query : customerDTOList) {
if (query.getJoin() == null) {
sb.append("AND ");
} else {
sb.append(query.getJoin() + " ");
// if ("like".equals(query.getOperator()) || "not like".equals(query.getOperator())) { // if ("like".equals(query.getOperator()) || "not like".equals(query.getOperator())) {
// sb.append("%"+ query.getCondition() + "% "); // sb.append("%"+ query.getCondition() + "% ");
// } else { // } else {
// sb.append(query.getCondition()); // sb.append(query.getCondition());
// } // }
// LIKE NOT
if (query.getField() == -1) {
sb.append(query.getJoin() + " C.CUSTOMER_ID " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -2) {
sb.append(query.getJoin() + "C.NAME " + query.getOperator() + " '%" + query.getCondition() + "% ");
} else if (query.getField() == -3) {
sb.append(query.getJoin() + " C.COMPANY_NAME " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -4) {
sb.append(query.getJoin() + " C.GENDER " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -5) {
sb.append(query.getJoin() + " C.CURRENT_ADDRESS " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -6) {
sb.append(query.getJoin() + " C.PLACE_OF_BIRTH " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -7) {
sb.append(query.getJoin() + " C.DATE_OF_BIRTH " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -8) {
sb.append(query.getJoin() + " C.MOBILE_NUMBER " + query.getOperator() + " %" + query.getCondition() + "% ");
} else if (query.getField() == -9) {
sb.append(query.getJoin() + " C.EMAIL " + query.getOperator() + " %" + query.getCondition() + "%' ");
} else if (query.getField() == -10) {
sb.append(query.getJoin() + " C.USER_NAME " + query.getOperator() + " %" + query.getCondition() + "%' ");
} else if (query.getField() == -11) {
sb.append(query.getJoin() + " C.CUSTOMER_TYPE " + query.getOperator() + " %" + query.getCondition() + "% ");
} }
switch (query.getField() + "") {
case "-1":
sb.append(" C.CUSTOMER_ID " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-2":
sb.append(" C.NAME " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-3":
sb.append(" C.COMPANY_NAME " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-4":
sb.append(" C.GENDER " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-5":
sb.append(" C.CURRENT_ADDRESS " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-6":
sb.append( " C.PLACE_OF_BIRTH " + query.getOperator() + "to_date(" + query.getCondition() + ", 'dd/mm/yyyy')");
break;
case "-7":
sb.append(" C.DATE_OF_BIRTH " + query.getOperator() + "to_date(" + query.getCondition() + ", 'dd/mm/yyyy')");
break;
case "-8":
sb.append(" C.MOBILE_NUMBER " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-9":
sb.append(" C.EMAIL " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-10":
sb.append(" C.USER_NAME " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
case "-11":
sb.append(" C.CUSTOMER_TYPE " + query.getOperator() + " '%" + query.getCondition() + "%' ");
break;
}
// if (query.getField() == -1) {
// sb.append(query.getJoin() + " C.CUSTOMER_ID " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -2) {
// sb.append(query.getJoin() + "C.NAME " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -3) {
// sb.append(query.getJoin() + " C.COMPANY_NAME " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -4) {
// sb.append(query.getJoin() + " C.GENDER " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -5) {
// sb.append(query.getJoin() + " C.CURRENT_ADDRESS " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -6) {
// sb.append(query.getJoin() + " C.PLACE_OF_BIRTH " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -7) {
// sb.append(query.getJoin() + " C.DATE_OF_BIRTH " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -8) {
// sb.append(query.getJoin() + " C.MOBILE_NUMBER " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -9) {
// sb.append(query.getJoin() + " C.EMAIL " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -10) {
// sb.append(query.getJoin() + " C.USER_NAME " + query.getOperator() + " %" + query.getCondition() + "% ");
// } else if (query.getField() == -11) {
// sb.append(query.getJoin() + " C.CUSTOMER_TYPE " + query.getOperator() + " %" + query.getCondition() + "% ");
// }
} }
SQLQuery query = session.createSQLQuery(sb.toString()); SQLQuery query = session.createSQLQuery(sb.toString());
query.addScalar("customerId", new LongType()); query.addScalar("customerId", new LongType());
......
...@@ -267,7 +267,6 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -267,7 +267,6 @@ public class ScenarioServiceImpl implements ScenarioService {
File file = new File(path); File file = new File(path);
FileInputStream fis = new FileInputStream(file); FileInputStream fis = new FileInputStream(file);
workbook = new XSSFWorkbook(fis); workbook = new XSSFWorkbook(fis);
workbook = new XSSFWorkbook(fis);
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
Sheet sheet = workbook.getSheetAt(0); Sheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(2); Row row = sheet.getRow(2);
...@@ -449,7 +448,7 @@ public class ScenarioServiceImpl implements ScenarioService { ...@@ -449,7 +448,7 @@ public class ScenarioServiceImpl implements ScenarioService {
result.put("message", BundleUtils.getLangString("customer.errorValidate", locale)); result.put("message", BundleUtils.getLangString("customer.errorValidate", locale));
}finally { }finally {
if (workbook != null) workbook.close(); if (workbook != null) workbook.close();
result.put("code", Constants.FILE_UPLOAD_RESP_CODE.ERROR); //result.put("code", Constants.FILE_UPLOAD_RESP_CODE.ERROR);
} }
return result; return result;
} }
......
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