Commit 6c5ea055 authored by xiaoguang.xu's avatar xiaoguang.xu

fix : 修复傻逼模糊查询的问题. 暂时不允许. 直接给个空

parent e1686bf4
package cn.quantgroup.xyqb.service.user.impl;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import cn.quantgroup.acolyte.buddhistscriptures.pojo.UserRealInfo;
import cn.quantgroup.xyqb.Constants;
import cn.quantgroup.xyqb.entity.User;
......@@ -34,6 +13,23 @@ import cn.quantgroup.xyqb.service.auth.IIdCardService;
import cn.quantgroup.xyqb.service.user.IUserDetailService;
import cn.quantgroup.xyqb.service.user.vo.UserDetailVO;
import cn.quantgroup.xyqb.util.ValidationUtil;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.persistence.criteria.Predicate;
import java.util.*;
import java.util.stream.Collectors;
/**
* Created by 11 on 2016/12/29.
......@@ -130,12 +126,20 @@ public class UserDetailServiceImpl implements IUserDetailService {
if(ValidationUtil.validatePhoneNo(phoneNo)){
list.add(criteriaBuilder.equal(root.get(Constants.PHONE_NO).as(String.class), phoneNo));
}else if (StringUtils.isNotBlank(phoneNo)) {
if (phoneNo.length() < 9) {
log.info("哪个傻逼用这么少的数字查. phoneNo:{}", phoneNo);
return null;
}
list.add(criteriaBuilder.like(root.get(Constants.PHONE_NO).as(String.class), phoneNo.concat("%")));
}
if (StringUtils.isNotBlank(idNo)) {
if(Objects.equals(Constants.IDNO_LENGTH, idNo.length())){
list.add(criteriaBuilder.equal(root.get("idNo").as(String.class), idNo));
}else{
if (idNo.length() < 16) {
log.info("哪个傻逼用这么少的数字查. idNo:{}", idNo);
return null;
}
list.add(criteriaBuilder.like(root.get("idNo").as(String.class), idNo.concat("%")));
}
}
......
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