|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|