Commit 90ccd9ea authored by Vu Duy Anh's avatar Vu Duy Anh

anhvd accept merge

parents 80a659bd af2c4822
...@@ -30,27 +30,27 @@ public class CorsFilter implements Filter { ...@@ -30,27 +30,27 @@ public class CorsFilter implements Filter {
HttpServletRequest request = (HttpServletRequest) req; HttpServletRequest request = (HttpServletRequest) req;
// chain.doFilter(req, response); chain.doFilter(req, response);
if ("OPTIONS".equalsIgnoreCase(request.getMethod())) { // if ("OPTIONS".equalsIgnoreCase(request.getMethod())) {
chain.doFilter(req, resp); // chain.doFilter(req, resp);
return; // return;
} // }
if ("/".equals(request.getRequestURI())) { // if ("/".equals(request.getRequestURI())) {
chain.doFilter(req, resp); // chain.doFilter(req, resp);
return; // return;
} // }
String xAuthToken = request.getHeader("X-Auth-Token"); // String xAuthToken = request.getHeader("X-Auth-Token");
if (xAuthToken == null || "".equals(xAuthToken)) { // if (xAuthToken == null || "".equals(xAuthToken)) {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null."); // response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is null.");
return; // return;
} // }
Object obj = RedisUtil.getInstance().get(xAuthToken); // Object obj = RedisUtil.getInstance().get(xAuthToken);
if (obj instanceof UserSession) { // if (obj instanceof UserSession) {
chain.doFilter(req, resp); // chain.doFilter(req, resp);
} else { // } else {
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid."); // response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "The token is invalid.");
} // }
} }
@Override @Override
......
package com.viettel.campaign.repository.ccms_full;
import com.viettel.campaign.model.ccms_full.Customer;
import java.util.List;
public interface CustomerQueryRepository {
List<Customer> findAll(String rsqlQuery);
}
...@@ -638,6 +638,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom { ...@@ -638,6 +638,7 @@ public class CampaignRepositoryImpl implements CampaignRepositoryCustom {
"),\n" + "),\n" +
"data as (\n" + "data as (\n" +
"select a.*, rownum row_ from data_temp a\n" + "select a.*, rownum row_ from data_temp a\n" +
"where a.totalCusList > 0" +
"),\n" + "),\n" +
"count_data as (\n" + "count_data as (\n" +
"select count(*) totalRow from data_temp\n" + "select count(*) totalRow from data_temp\n" +
......
package com.viettel.campaign.repository.ccms_full.impl;
import com.github.tennaito.rsql.jpa.JpaCriteriaQueryVisitor;
import com.viettel.campaign.model.ccms_full.Customer;
import com.viettel.campaign.repository.ccms_full.CustomerQueryRepository;
import cz.jirutka.rsql.parser.RSQLParser;
import cz.jirutka.rsql.parser.ast.Node;
import cz.jirutka.rsql.parser.ast.RSQLVisitor;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;
import java.util.List;
public class CustomerQueryRepositoryImpl implements CustomerQueryRepository {
@PersistenceContext
private EntityManager entityManager;
private RSQLVisitor<CriteriaQuery<Customer>, EntityManager> visitor = new JpaCriteriaQueryVisitor<Customer>();
private RSQLParser parser = new RSQLParser();
@Override
public List<Customer> findAll(String rsqlQuery) {
Node node = parser.parse(rsqlQuery);
CriteriaQuery<Customer> query = node.accept(visitor, entityManager);
return entityManager.createQuery(query).getResultList();
}
}
...@@ -77,5 +77,6 @@ public interface CustomerService { ...@@ -77,5 +77,6 @@ public interface CustomerService {
Long countByQuery(String queryString); Long countByQuery(String queryString);
// Map<String, CustomizeRequestDTo> searchCustomer(); // Map<String, CustomizeRequestDTo> searchCustomer();
//// List<CustomizeFields> searchCustomize(); //// List<CustomizeFields> searchCustomize();
ResultDTO searchCustomizeFields(CustomizeRequestDTo customizeFields); ResultDTO listCustomizeFields(CustomizeRequestDTo customizeFields);
ResultDTO searchCustomizeFields(CustomizeRequestDTo customizeRequestDTo);
} }
...@@ -83,6 +83,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService { ...@@ -83,6 +83,7 @@ public class CampaignCfgServiceImpl implements CampaignCfgService {
sb.append(" and COMPANY_SITE_ID = :p_company_site_id"); sb.append(" and COMPANY_SITE_ID = :p_company_site_id");
sb.append(" and COMPLETE_VALUE not in (1,2,3,4)"); sb.append(" and COMPLETE_VALUE not in (1,2,3,4)");
sb.append("ORDER BY to_number(COMPLETE_VALUE) "); sb.append("ORDER BY to_number(COMPLETE_VALUE) ");
logger.info("SQL statement: " + sb);
......
...@@ -555,6 +555,7 @@ public class CampaignServiceImpl implements CampaignService { ...@@ -555,6 +555,7 @@ public class CampaignServiceImpl implements CampaignService {
List<CampaignCustomer> list = campaignCustomerRepository.findCustomerContacted(campaignId, companySiteId, Long.parseLong(cusListId)); List<CampaignCustomer> list = campaignCustomerRepository.findCustomerContacted(campaignId, companySiteId, Long.parseLong(cusListId));
for (CampaignCustomer campaignCustomer: list) { for (CampaignCustomer campaignCustomer: list) {
campaignCustomer.setInCampaignStatus((short) 0); campaignCustomer.setInCampaignStatus((short) 0);
campaignCustomerRepository.save(campaignCustomer);
} }
} }
resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS); resultDTO.setErrorCode(Constants.ApiErrorCode.SUCCESS);
......
...@@ -609,16 +609,18 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -609,16 +609,18 @@ public class CustomerServiceImpl implements CustomerService {
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd"); DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd");
Date currentDate = new Date(dateFormat.format(new Date())); Date currentDate = new Date(dateFormat.format(new Date()));
Date oldDate = new Date(apParam.getDescription()); Date oldDate = new Date(apParam.getDescription());
Long newDay = (currentDate.getTime() - oldDate.getTime())/(1000*60*60*24); Long newDay = (currentDate.getTime() - oldDate.getTime()) / (1000 * 60 * 60 * 24);
String convertDate = dateFormat.format(new Date()); String convertDate = dateFormat.format(new Date());
String[] dateArray = convertDate.split("/"); String[] dateArray = convertDate.split("/");
if (customerListDTO.getCustomerListCode().trim().length() == 0) {
if (newDay == 0) { if (newDay == 0) {
apParamRepository.updateCustomerListSeq(String.valueOf(Integer.parseInt(apParam.getParValue()) + 1), apParam.getDescription()); apParamRepository.updateCustomerListSeq(String.valueOf(Integer.parseInt(apParam.getParValue()) + 1), apParam.getDescription());
customerListDTO.setCustomerListCode(dateArray[0]+dateArray[2]+dateArray[1]+"_"+(Integer.parseInt(apParam.getParValue()) + 1)+" "+customerListDTO.getCustomerListCode()); customerListDTO.setCustomerListCode(dateArray[0]+dateArray[2]+dateArray[1]+"_"+(Integer.parseInt(apParam.getParValue()) + 1));
} else { } else {
apParamRepository.updateCustomerListSeq("1", dateFormat.format(new Date())); apParamRepository.updateCustomerListSeq("1", dateFormat.format(new Date()));
customerListDTO.setCustomerListCode(dateArray[0]+dateArray[2]+dateArray[1]+"_1"+" "+customerListDTO.getCustomerListCode()); customerListDTO.setCustomerListCode(dateArray[0]+dateArray[2]+dateArray[1]+"_1");
}
} }
// THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI // THÍM NÀO MERGE CONFLICT THÌ GIỮ LẠI HỘ E CÁI METHOD NÀY VỚI
...@@ -794,13 +796,13 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -794,13 +796,13 @@ 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 BETWEEN to_date(:p_date_from, 'YYYYMMDD') AND to_date(:p_date_to, 'YYYYMMDD')"); sb.append(" AND to_date(CREATE_AT, 'DD-MM-RR') >= to_date(:p_date_from, 'YYYYMMDD') AND to_date(CREATE_AT, 'DD-MM-RR') <= to_date(:p_date_to, 'YYYYMMDD')");
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) { if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) {
sb.append(" AND CUSTOMER_LIST_CODE LIKE :p_list_code"); sb.append(" AND UPPER(CUSTOMER_LIST_CODE) LIKE UPPER(:p_list_code)");
} }
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListName())) { if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListName())) {
sb.append(" AND CUSTOMER_LIST_NAME LIKE :p_list_name"); sb.append(" AND UPPER(CUSTOMER_LIST_NAME) LIKE UPPER(:p_list_name)");
} }
sb.append(" ORDER BY CREATE_AT DESC"); sb.append(" ORDER BY CREATE_AT DESC");
...@@ -813,7 +815,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -813,7 +815,7 @@ public class CustomerServiceImpl implements CustomerService {
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) { if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListCode())) {
query.setParameter("p_list_code", "%" + query.setParameter("p_list_code", "%" +
searchCustomerRequestDTO.getCustomerListCode() searchCustomerRequestDTO.getCustomerListCode().trim()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\_") .replaceAll("_", "\\_")
...@@ -822,7 +824,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -822,7 +824,7 @@ public class CustomerServiceImpl implements CustomerService {
if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListName())) { if (!DataUtil.isNullOrEmpty(searchCustomerRequestDTO.getCustomerListName())) {
query.setParameter("p_list_name", "%" + query.setParameter("p_list_name", "%" +
searchCustomerRequestDTO.getCustomerListName() searchCustomerRequestDTO.getCustomerListName().trim()
.replace("\\", "\\\\") .replace("\\", "\\\\")
.replaceAll("%", "\\%") .replaceAll("%", "\\%")
.replaceAll("_", "\\_") .replaceAll("_", "\\_")
...@@ -1585,6 +1587,13 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1585,6 +1587,13 @@ public class CustomerServiceImpl implements CustomerService {
sb.append(" from customer_contact cc"); sb.append(" from customer_contact cc");
sb.append(" where cc.contact_type = 2"); sb.append(" where cc.contact_type = 2");
sb.append(" and status = 1"); sb.append(" and status = 1");
sb.append(" )," +
"cusInCampaign as (" +
"select * from campaign_customer " +
"where campaign_id = :p_campaign_id " +
"and company_site_id = :p_company_site_id " +
"and customer_list_id is null " +
"and in_campaign_status = 1");
sb.append(" ), datas as ("); sb.append(" ), datas as (");
sb.append(" select c.customer_id customerId,"); sb.append(" select c.customer_id customerId,");
sb.append(" c.name,"); sb.append(" c.name,");
...@@ -1595,6 +1604,7 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1595,6 +1604,7 @@ public class CustomerServiceImpl implements CustomerService {
sb.append(" c.current_address currentAddress,"); sb.append(" c.current_address currentAddress,");
sb.append(" c.description"); sb.append(" c.description");
sb.append(" from customer c"); sb.append(" from customer c");
sb.append(" inner join cusInCampaign cc on c.customer_id = cc.customer_id");
sb.append(" left join cusPhone cP on c.customer_id = cP.cusId"); sb.append(" left join cusPhone cP on c.customer_id = cP.cusId");
sb.append(" left join cusEmail cE on c.customer_id = cE.cusId"); sb.append(" left join cusEmail cE on c.customer_id = cE.cusId");
sb.append(" )"); sb.append(" )");
...@@ -1613,8 +1623,11 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1613,8 +1623,11 @@ public class CustomerServiceImpl implements CustomerService {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("p_page_number", campaignCustomerDTO.getPage()); param.put("p_page_number", campaignCustomerDTO.getPage());
param.put("p_page_size", campaignCustomerDTO.getPageSize()); param.put("p_page_size", campaignCustomerDTO.getPageSize());
param.put("p_campaign_id", campaignCustomerDTO.getCampaignId());
param.put("p_company_site_id", campaignCustomerDTO.getCompanySiteId());
customerList = namedParameterJdbcTemplate.query(sb.toString(), param, new BeanPropertyRowMapper<>(CustomerDTO.class)); customerList = namedParameterJdbcTemplate.query(sb.toString(), param, new BeanPropertyRowMapper<>(CustomerDTO.class));
} catch (Exception e) { } catch (Exception e) {
LOGGER.error(e.getMessage(), e);
return null; return null;
} }
return customerList; return customerList;
...@@ -1691,48 +1704,77 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1691,48 +1704,77 @@ public class CustomerServiceImpl implements CustomerService {
// sb.append(""); // sb.append("");
// sb.append(""); // sb.append("");
@Override @Override
public ResultDTO searchCustomizeFields(CustomizeRequestDTo customizeFields) { public ResultDTO listCustomizeFields(CustomizeRequestDTo customizeFields) {
ResultDTO resultDTO = new ResultDTO(); ResultDTO resultDTO = new ResultDTO();
Map<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
List<FieldsToShowDTO> list = new ArrayList<>(); List<CustomizeFielObjectDTO> list;
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
try { try {
stringBuilder.append(" with column_name_temp as ("); // stringBuilder.append(" with column_name_temp as (");
stringBuilder.append(" select 'CUSTOMER_ID' ,1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'CUSTOMER_ID' ,1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'CUSTOMER_NAME' ,1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'CUSTOMER_NAME' ,1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'CUSTOMER_TYPE' ,1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'CUSTOMER_TYPE' ,1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'NAME' ,1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'NAME' ,1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'CURRENT_ADDRESS', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'CURRENT_ADDRESS', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'PLACE_OF_BIRTH', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'PLACE_OF_BIRTH', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'DATE_OF_BIRTH', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'DATE_OF_BIRTH', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'MOBILE_NUMBER', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'MOBILE_NUMBER', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'EMAIL', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'EMAIL', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'USERNAME', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'USERNAME', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select 'CUSTOMER_TYPE', 1 isFix from user_tab_columns, dual"); // stringBuilder.append(" select 'CUSTOMER_TYPE', 1 isFix from user_tab_columns, dual");
stringBuilder.append(" where table_name = 'CUSTOMER'"); // stringBuilder.append(" where table_name = 'CUSTOMER'");
stringBuilder.append(" )"); // stringBuilder.append(" )");
//
stringBuilder.append(" select * from column_name_temp"); // stringBuilder.append(" select * from column_name_temp");
stringBuilder.append(" union all"); // stringBuilder.append(" union all");
stringBuilder.append(" select title columnName, 0 isFix "); // stringBuilder.append(" select title columnName, 0 isFix ");
stringBuilder.append(" from customize_fields, dual"); // stringBuilder.append(" from customize_fields, dual");
stringBuilder.append(" where function_code = 'CUSTOMER'"); // stringBuilder.append(" where function_code = 'CUSTOMER'");
stringBuilder.append(" and site_id = :p_company_site_id"); // stringBuilder.append(" and site_id = :p_company_site_id");
stringBuilder.append(" and STATUS = 1"); // stringBuilder.append(" and STATUS = 1");
// stringBuilder.append(" and active = 1 ");
stringBuilder.append("SELECT C.NAME name," +
" C.CUSTOMER_ID customerID," +
" C.CURRENT_ADDRESS currentAddress," +
" C.USERNAME username," +
" C.GENDER gender," +
" C.COMPANY_NAME companyName" +
" C.DATE_OF_BIRTH dateOfBirth," +
" C.COMPANY_NAME companyName," +
" C.CUSTOMER_TYPE customerType," +
" C.PLACE_OF_BIRTH placeOfBirth," +
" C.CUSTOMER_TYPE customerType," +
" C.EMAIL email," +
" C.USERNAME username" +
" C.NAME name," +
" C.MOBILE_NUMBER mobileNumber," +
" C.SITE_ID siteId," +
" C.STATUS status," +
" CF.FUNCTION_CODE functionCode," +
" CFO.ACTIVE active" +
" CFO.*");
stringBuilder.append("FROM CUSTOMER C");
stringBuilder.append(" INNER JOIN CUSTOMIZE_FIELD_OBJECT CFO ON C.CUSTOMER_ID = CFO.OBJECT_ID");
stringBuilder.append(" INNER JOIN CUSTOMIZE_FIELDS CF ON CF.CUSTOMIZE_FIELD_ID = CFO.CUSTOMIZE_FIELDS_ID\n" +
"WHERE 1 = 1");
// stringBuilder.append(" and C.SITE_ID = :p_company_site_id");
stringBuilder.append(" and CFO.STATUS = 1");
stringBuilder.append(" and active = 1 "); stringBuilder.append(" and active = 1 ");
params.put("p_company_site_id", customizeFields.getCompanySiteId()); stringBuilder.append(" and CF.FUNCTION_CODE = 'CUSTOMER' ");
params.put("p_company_site_id", customizeFields.getSiteId());
params.put("p_customer_id", customizeFields.getCustomerId()); params.put("p_customer_id", customizeFields.getCustomerId());
list = namedParameterJdbcTemplate.query(stringBuilder.toString(), params, BeanPropertyRowMapper.newInstance(FieldsToShowDTO.class)); 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(list); resultDTO.setListData(list);
...@@ -1745,6 +1787,10 @@ public class CustomerServiceImpl implements CustomerService { ...@@ -1745,6 +1787,10 @@ public class CustomerServiceImpl implements CustomerService {
} }
@Override
public ResultDTO searchCustomizeFields(CustomizeRequestDTo customizeRequestDTo) {
ResultDTO resultDTO = new ResultDTO();
return resultDTO;
}
} }
...@@ -5,13 +5,14 @@ import lombok.Getter; ...@@ -5,13 +5,14 @@ import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Getter @Getter
@Setter @Setter
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class CustomizeFielObjectDTO { public class CustomizeFielObjectDTO implements Serializable {
private Long customerId; private Long customerId;
private String name; private String name;
private String companyName; private String companyName;
...@@ -40,4 +41,6 @@ public class CustomizeFielObjectDTO { ...@@ -40,4 +41,6 @@ public class CustomizeFielObjectDTO {
private Long fieldOptionValueId; private Long fieldOptionValueId;
private String title; private String title;
private String functionCode; private String functionCode;
private String active;
} }
...@@ -5,13 +5,26 @@ import com.viettel.campaign.web.dto.BaseDTO; ...@@ -5,13 +5,26 @@ import com.viettel.campaign.web.dto.BaseDTO;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import java.util.Date;
@Getter @Getter
@Setter @Setter
public class CustomizeRequestDTo extends BaseDTO { public class CustomizeRequestDTo extends BaseDTO {
String operatorLogic; String operatorLogic;
String name;
String filterCustomer; String filterCustomer;
String compare; String compare;
String valueCustomer; String valueCustomer;
String companySiteId;
String customerId; String customerId;
String companyName;
String status;
String siteId;
Short gender;
String currentAddress;
String placeOfBirth;
Date dateOfBirth;
String mobileNumber;
String email;
String userName;
Long customerType;
} }
...@@ -3,6 +3,8 @@ package com.viettel.campaign.web.rest; ...@@ -3,6 +3,8 @@ package com.viettel.campaign.web.rest;
import com.viettel.campaign.model.ccms_full.Customer; import com.viettel.campaign.model.ccms_full.Customer;
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.repository.ccms_full.CustomerQueryRepository;
import com.viettel.campaign.repository.ccms_full.impl.CustomerQueryRepositoryImpl;
import com.viettel.campaign.service.CustomerService; import com.viettel.campaign.service.CustomerService;
import com.viettel.campaign.utils.BundleUtils; import com.viettel.campaign.utils.BundleUtils;
import com.viettel.campaign.utils.Config; import com.viettel.campaign.utils.Config;
...@@ -38,6 +40,7 @@ import java.util.*; ...@@ -38,6 +40,7 @@ import java.util.*;
@RequestMapping("/ipcc/customer") @RequestMapping("/ipcc/customer")
@CrossOrigin(origins = "*") @CrossOrigin(origins = "*")
public class CustomerController { public class CustomerController {
private CustomerQueryRepository customerQueryRepo;
private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class); private static final Logger LOGGER = LoggerFactory.getLogger(CustomerController.class);
...@@ -113,6 +116,7 @@ public class CustomerController { ...@@ -113,6 +116,7 @@ public class CustomerController {
// VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY // VIẾT ĐI VIẾT LẠI 4 LẦN RỒI ĐẤY
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);
if (userSession == null) { if (userSession == null) {
userSession = new UserSession(); userSession = new UserSession();
userSession.setSiteId(customerListDTO.getCompanySiteId()); userSession.setSiteId(customerListDTO.getCompanySiteId());
...@@ -248,6 +252,8 @@ public class CustomerController { ...@@ -248,6 +252,8 @@ public class CustomerController {
return new ResponseEntity<>(data, HttpStatus.OK); return new ResponseEntity<>(data, HttpStatus.OK);
} }
private String saveUploadFile(MultipartFile file) { private String saveUploadFile(MultipartFile file) {
try { try {
String currentTime = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss").format(new Date()); String currentTime = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss").format(new Date());
...@@ -267,6 +273,15 @@ public class CustomerController { ...@@ -267,6 +273,15 @@ public class CustomerController {
} }
return null; return null;
} }
// @GetMapping("/query")
// public ResponseEntity<List<Customer>> query(@RequestParam(value = "search") String query) {
// List<Customer> things = customerQueryRepo.findAll(query);
// if (things.isEmpty()) {
// return ResponseEntity.noContent().build();
// }
// return ResponseEntity.ok(things);
// }
@GetMapping(path = "", produces = { MediaType.APPLICATION_JSON_VALUE }) @GetMapping(path = "", produces = { MediaType.APPLICATION_JSON_VALUE })
public ResponseEntity<List<Customer>> query(@RequestParam(value = "search") String query) { public ResponseEntity<List<Customer>> query(@RequestParam(value = "search") String query) {
List<Customer> result = null; List<Customer> result = null;
...@@ -282,7 +297,7 @@ public class CustomerController { ...@@ -282,7 +297,7 @@ public class CustomerController {
@PostMapping("/getCustomizeFields") @PostMapping("/getCustomizeFields")
@ResponseBody @ResponseBody
public ResponseEntity<?> getListFieldsToShow(@RequestBody CustomizeRequestDTo customizeRequestDTo) { public ResponseEntity<?> getListFieldsToShow(@RequestBody CustomizeRequestDTo customizeRequestDTo) {
ResultDTO resultDTO = customerService.searchCustomizeFields(customizeRequestDTo); ResultDTO resultDTO = customerService.listCustomizeFields(customizeRequestDTo);
return new ResponseEntity<>(resultDTO, HttpStatus.OK); return new ResponseEntity<>(resultDTO, HttpStatus.OK);
} }
} }
...@@ -62,13 +62,13 @@ DATE_OF_BIRTH = Ngày sinh ...@@ -62,13 +62,13 @@ DATE_OF_BIRTH = Ngày sinh
MOBILE_NUMBER = Số điện thoại MOBILE_NUMBER = Số điện thoại
USERNAME = Tài khoản USERNAME = Tài khoản
AREA_CODE = Khu vực AREA_CODE = Khu vực
CALL_ALLOWED = CALL_ALLOWED CALL_ALLOWED = Cho phép gọi
EMAIL_ALLOWED = EMAIL_ALLOWED EMAIL_ALLOWED = Cho phép gửi email
SMS_ALLOWED = SMS_ALLOWED SMS_ALLOWED = Cho phép gửi sms
IPCC_STATUS = IPCC_STATUS IPCC_STATUS = Trạng thái Ipcc
EMAIL = EMAIL EMAIL = Email
CUSTOMER_TYPE = CUSTOMER_TYPE CUSTOMER_TYPE = Loại khách hàng
AVATAR_LINK = AVATAR_LINK AVATAR_LINK = Đường dẫn ảnh đại diện
#Customer Excel Header #Customer Excel Header
customer.no = STT customer.no = STT
......
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