Commit 5de6b024 authored by xiaoguang.xu's avatar xiaoguang.xu

idNo模糊查询用户信息

parent 5a12a8bb
......@@ -600,7 +600,7 @@ public class InnerController implements IBaseController {
* @param name - 姓名
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @return JsonResult<List < UserDetail>>
* @return JsonResult<List < UserDetail>>
*/
@RequestMapping("/user_detail/search_list")
@ApiOperation(httpMethod = "POST", value = "按照姓名、份证号或手机号查询用户实名信息 - 精确查询,供客服用,不限制入参正确性")
......@@ -619,16 +619,16 @@ public class InnerController implements IBaseController {
*
* @param phoneNo - 手机号
* @param idNo - 身份证号
* @return JsonResult<List < UserDetail>>
* @return JsonResult<List < UserDetail>>
*/
@ApiOperation(httpMethod = "POST", value = "按照身份证号和手机号查询用户实名信息查询 - 模糊查询")
@RequestMapping("/user_detail/fuzzyQuery")
@TargetDataSource(type = DSType.SLAVE)
public JsonResult<List<UserDetail>> fuzzyQueryUserDetailList(@ApiParam(value = "手机号", required = true) @RequestParam(name = "phoneNo") String phoneNo,
@ApiParam(value = "身份证号", required = true) @RequestParam(name = "idNo") String idNo,
@ApiParam(value = "用户姓名") @RequestParam(name = "userName", required = false) String userName) {
public JsonResult<List<UserDetail>> fuzzyQueryUserDetailList(@ApiParam(value = "手机号") @RequestParam(name = "phoneNo") String phoneNo,
@ApiParam(value = "身份证号") @RequestParam(name = "idNo") String idNo,
@ApiParam(value = "用户姓名") @RequestParam(name = "userName") String userName) {
log.info("fuzzyQueryUserDetailList, phone:{},idNo:{},ip:{}", phoneNo, idNo, getIp());
if (StringUtils.isBlank(phoneNo) || StringUtils.isBlank(idNo)) {
if (StringUtils.isBlank(phoneNo) && StringUtils.isBlank(idNo)) {
return JsonResult.buildErrorStateResult("查询条件不能为空", null);
}
//最多掩码四位
......@@ -645,6 +645,14 @@ public class InnerController implements IBaseController {
}
return JsonResult.buildSuccessResult("success", userDetailList);
}
if (!phoneNoValid && idNoValid) {
List<UserDetail> userDetailList = userDetailService.findByIdNoStartingWith(idNo);
return JsonResult.buildSuccessResult("success", userDetailList);
}
if (phoneNoValid) {
List<UserDetail> userDetailList = userDetailService.findByPhoneNoStartingWith(phoneNo);
return JsonResult.buildSuccessResult("success", userDetailList);
}
return JsonResult.buildErrorStateResult("查询条件不规范!", null);
}
......
......@@ -60,6 +60,10 @@ public interface IUserDetailRepository extends JpaRepository<UserDetail, Long>,
@Query(value = "select * from user_detail where phone_no like ?1 and id_no like ?2", nativeQuery = true)
List<UserDetail> fuzzyQueryByPhoneNoAndIdNo(String phoneNo, String idNo);
List<UserDetail> findByIdNoStartingWithLimit20(String idNo);
List<UserDetail> findByPhoneNoStartingWith(String phoneNo);
List<UserDetail> findByIdBetween(Long id, Long endId);
}
package cn.quantgroup.xyqb.service.user;
import java.util.List;
import cn.quantgroup.xyqb.entity.UserDetail;
import cn.quantgroup.xyqb.service.user.vo.UserDetailVO;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Page;
import cn.quantgroup.xyqb.entity.UserDetail;
import cn.quantgroup.xyqb.service.user.vo.UserDetailVO;
import java.util.List;
/**
* Created by 11 on 2016/12/29.
......@@ -30,6 +29,9 @@ public interface IUserDetailService {
List<UserDetail> findByIdnos(List<String> idnos);
List<UserDetail> findByIdNoStartingWith(String idNo);
List<UserDetail> findByPhoneNoStartingWith(String phoneNo);
Page<UserDetail> getUserDetailsPage(List<Long> userId, List<String> phoneNos, List<String> idNos, int pageNumber, int pageSize, String sortType);
/**
......
......@@ -120,6 +120,16 @@ public class UserDetailServiceImpl implements IUserDetailService {
});
}
@Override
public List<UserDetail> findByIdNoStartingWith(String idNo) {
return userDetailRepository.findByIdNoStartingWithLimit20(idNo);
}
@Override
public List<UserDetail> findByPhoneNoStartingWith(String phoneNo) {
return userDetailRepository.findByPhoneNoStartingWith(phoneNo);
}
private Specification<UserDetail> getSpecification(String name, String phoneNo, String idNo) {
List<Predicate> list = new ArrayList<>();
Specification<UserDetail> specification = (root, criteriaQuery, criteriaBuilder) -> {
......
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