Browse Source

根据身份证号找人:/epmetuser/user/finduser

dev_shibei_match
yinzuomei 4 years ago
parent
commit
95a564b77b
  1. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiUserFormDTO.java
  2. 2
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  3. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java
  4. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  5. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java
  6. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java
  7. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  8. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java
  9. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  10. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java
  11. 44
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java
  12. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml
  13. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml
  14. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml

9
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ResiUserFormDTO.java

@ -5,6 +5,9 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 根据身份证号找人也可根据epmetUserId查询或者icResiUserId
*/
@Data
public class ResiUserFormDTO implements Serializable {
public interface AddUserInternalGroup {
@ -15,4 +18,10 @@ public class ResiUserFormDTO implements Serializable {
@NotBlank(message = "客户id不能为空", groups = AddUserInternalGroup.class)
private String customerId;
private String epmetUserId;
private String icResiUserId;
//@NotBlank(message = "findType不能为空;根据身份证号:byIdNum;根据ic居民:byIc;根据小程序里的居民:byEpmetUser", groups = AddUserInternalGroup.class)
//private String findType;
}

2
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -662,7 +662,7 @@ public interface EpmetUserOpenFeignClient {
Result<List<CustomerStaffDTO>> getByRealNames(@RequestBody GetByRealNamesFormDTO formDTO);
/**
* 根据身份证号找人
* 根据身份证号找人也可根据epmetUserId查询或者icResiUserId
*
* @param formDTO
* @return

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java

@ -187,7 +187,7 @@ public class UserController {
}
/**
* 根据身份证号找人
* 根据身份证号找人也可根据epmetUserId查询或者icResiUserId
*
*
* @param formDTO

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java

@ -163,5 +163,7 @@ public interface IcResiUserDao extends BaseDao<IcResiUserEntity> {
@Param("gridId")String gridId,
@Param("name")String name);
String selectIdByIdCard(@Param("customerId") String customerId, @Param("idNum")String idNum);
IcResiUserDTO selectIdByIdCard(@Param("customerId") String customerId,
@Param("idNum")String idNum,
@Param("icResiUserId")String icResiUserId);
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserBaseInfoDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.UserBaseInfoDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.UserWechatResultDTO;
@ -81,5 +82,7 @@ public interface UserBaseInfoDao extends BaseDao<UserBaseInfoEntity> {
**/
String selectIdByUserId(@Param("userId") String userId);
String selectUserId(@Param("customerId") String customerId, @Param("idNum")String idNum);
UserBaseInfoDTO selectUserId(@Param("customerId") String customerId,
@Param("idNum")String idNum,
@Param("userId")String userId);
}

4
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserResiInfoDao.java

@ -104,5 +104,7 @@ public interface UserResiInfoDao extends BaseDao<UserResiInfoEntity> {
*/
Integer selectCountByIdNum(@Param("idNum") String idNum,@Param("customerId") String customerId);
String selectByIdNum(@Param("customerId") String customerId, @Param("idNum")String idNum);
UserResiInfoDTO selectByIdNum(@Param("customerId") String customerId,
@Param("idNum")String idNum,
@Param("userId")String userId);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -20,6 +20,7 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.IcResiUserEntity;
@ -149,5 +150,5 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @param idNum
* @return
*/
String getByIdCard(String customerId, String idNum);
IcResiUserDTO getByIdCard(String customerId, String idNum,String icResiUserId);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserBaseInfoService.java

@ -190,5 +190,5 @@ public interface UserBaseInfoService extends BaseService<UserBaseInfoEntity> {
**/
ExtUserInfoResultDTO extUserInfo(CommonUserIdFormDTO param);
String getUserIdByIdNum(String customerId, String idNum);
UserBaseInfoDTO getUserIdByIdNum(String customerId, String idNum,String userId);
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -859,7 +859,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @return
*/
@Override
public String getByIdCard(String customerId, String idNum) {
return baseDao.selectIdByIdCard(customerId,idNum);
public IcResiUserDTO getByIdCard(String customerId, String idNum,String icResiUserId) {
if(StringUtils.isBlank(idNum)&&StringUtils.isBlank(icResiUserId)){
return null;
}
return baseDao.selectIdByIdCard(customerId,idNum,icResiUserId);
}
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -444,7 +444,10 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
}
@Override
public String getUserIdByIdNum(String customerId, String idNum) {
return baseDao.selectUserId(customerId,idNum);
public UserBaseInfoDTO getUserIdByIdNum(String customerId, String idNum,String userId) {
if(StringUtils.isBlank(idNum)&&StringUtils.isBlank(userId)){
return null;
}
return baseDao.selectUserId(customerId,idNum,userId);
}
}

44
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserServiceImpl.java

@ -2,16 +2,19 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.CpUserDetailRedis;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.UserConstant;
import com.epmet.dao.*;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.UserDTO;
import com.epmet.dto.UserResiInfoDTO;
import com.epmet.dto.UserWechatDTO;
import com.epmet.dao.UserDao;
import com.epmet.dao.UserResiInfoDao;
import com.epmet.dao.UserRoleDao;
import com.epmet.dao.UserWechatDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.UserBaseInfoEntity;
@ -347,21 +350,38 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
}
/**
* 根据身份证号找人
* 根据身份证号找人也可根据epmetUserId查询或者icResiUserId
*
* @param formDTO
* @return
*/
@Override
public ResiUserResDTO findUser(ResiUserFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getIdNum()) && StringUtils.isBlank(formDTO.getEpmetUserId()) && StringUtils.isBlank(formDTO.getIcResiUserId())) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(),"身份证号、epmetuserId、icResiUserId至少输入一个","至少选择一种查询方式");
}
ResiUserResDTO resiUserResDTO = ConvertUtils.sourceToTarget(formDTO, ResiUserResDTO.class);
String icResiUserId = icResiUserService.getByIdCard(formDTO.getCustomerId(), formDTO.getIdNum());
resiUserResDTO.setIcResiUserId(icResiUserId);
String userId = userBaseInfoService.getUserIdByIdNum(formDTO.getCustomerId(), formDTO.getIdNum());
if (StringUtils.isBlank(userId)) {
resiUserResDTO.setEpmetUserId(userResiInfoDao.selectByIdNum(formDTO.getCustomerId(), formDTO.getIdNum()));
//可以根据身份证号查询,也可以根据ic_resi_user.id查询
if (StringUtils.isBlank(formDTO.getIcResiUserId())) {
IcResiUserDTO icResiUser = icResiUserService.getByIdCard(formDTO.getCustomerId(), formDTO.getIdNum(), formDTO.getIcResiUserId());
resiUserResDTO.setIcResiUserId(null != icResiUser ? icResiUser.getId() : StrConstant.EPMETY_STR);
resiUserResDTO.setIdNum(null != icResiUser ? icResiUser.getIdCard() : StrConstant.EPMETY_STR);
}
//可以根据身份证号查询,也可以根据epmet_user.user.id查询
if (StringUtils.isBlank(formDTO.getEpmetUserId())) {
UserBaseInfoDTO userBaseInfoDTO = userBaseInfoService.getUserIdByIdNum(formDTO.getCustomerId(),
formDTO.getIdNum(),
formDTO.getEpmetUserId());
if (null == userBaseInfoDTO || StringUtils.isBlank(userBaseInfoDTO.getUserId())) {
log.info("user_base_info没有找到,去查下user_resi_info表吧");
UserResiInfoDTO userResiInfoDTO = userResiInfoDao.selectByIdNum(formDTO.getCustomerId(),
formDTO.getIdNum(),
formDTO.getEpmetUserId());
resiUserResDTO.setEpmetUserId(null != userResiInfoDTO ? userResiInfoDTO.getId() : StrConstant.EPMETY_STR);
} else {
resiUserResDTO.setEpmetUserId(userBaseInfoDTO.getUserId());
}
}
resiUserResDTO.setEpmetUserId(userId);
return resiUserResDTO;
}

11
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -309,14 +309,19 @@
CONVERT ( ir.NAME USING gbk ) ASC
</select>
<select id="selectIdByIdCard" parameterType="map" resultType="java.lang.String">
<select id="selectIdByIdCard" parameterType="map" resultType="com.epmet.dto.IcResiUserDTO">
select
ir.id
ir.*
FROM
ic_resi_user ir
WHERE
ir.DEL_FLAG = '0'
and ir.customer_id=#{customerId}
and ir.ID_CARD=#{idNum}
<if test="idNum != null and idNum != ''">
and ir.ID_CARD=#{idNum}
</if>
<if test="icResiUserId != null and icResiUserId != ''">
and ir.id=#{icResiUserId}
</if>
</select>
</mapper>

11
epmet-user/epmet-user-server/src/main/resources/mapper/UserBaseInfoDao.xml

@ -121,12 +121,17 @@
AND USER_ID = #{userId}
</select>
<select id="selectUserId" parameterType="map" resultType="java.lang.String">
<select id="selectUserId" parameterType="map" resultType="com.epmet.dto.UserBaseInfoDTO">
SELECT
distinct user_id
*
FROM user_base_info
WHERE DEL_FLAG = '0'
AND customer_id = #{=customerId}
and id_num=#{idNum}
<if test="idNum != null and idNum != ''">
and id_num=#{idNum}
</if>
<if test="userId != null and userId != ''">
and user_id=#{userId}
</if>
</select>
</mapper>

11
epmet-user/epmet-user-server/src/main/resources/mapper/UserResiInfoDao.xml

@ -187,14 +187,19 @@
and uri.customer_id=#{customerId}
</select>
<select id="selectByIdNum" parameterType="map" resultType="java.lang.String">
<select id="selectByIdNum" parameterType="map" resultType="com.epmet.dto.UserResiInfoDTO">
SELECT
distinct uri.user_id
uri.*
FROM
user_resi_info uri
WHERE
uri.DEL_FLAG = '0'
AND uri.id_num = #{idNum}
and uri.customer_id=#{customerId}
<if test="idNum != null and idNum != ''">
AND uri.id_num = #{idNum}
</if>
<if test="userId != null and userId != ''">
and uri.user_id=#{userId}
</if>
</select>
</mapper>

Loading…
Cancel
Save