|
@ -639,81 +639,12 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public DingLoginResiResDTO hFiveResiLogin(HfiveLoginResiFormDTO formDTO) { |
|
|
public DingLoginResiResDTO hFiveResiLogin(HfiveLoginResiFormDTO formDTO) { |
|
|
DingLoginResiResDTO result = new DingLoginResiResDTO(); |
|
|
DingLoginResiResDTO result = new DingLoginResiResDTO(); |
|
|
result.setCustomerId(formDTO.getCustomerId()); |
|
|
// 用id获取userbaseInfo信息
|
|
|
result.setRegFlag(false); |
|
|
UserBaseInfoEntity baseInfo = baseDao.selectById(formDTO.getUserBaseInfoId()); |
|
|
result.setGridId(StrConstant.EPMETY_STR); |
|
|
|
|
|
result.setGridName(StrConstant.EPMETY_STR); |
|
|
|
|
|
result.setAgencyId(StrConstant.EPMETY_STR); |
|
|
|
|
|
RLock lock = null; |
|
|
|
|
|
try { |
|
|
|
|
|
lock = distributedLock.getLock(String.format("epmet:lock:dingResiLogin:%s",formDTO.getMobile()), 120L, 3L, TimeUnit.SECONDS); |
|
|
|
|
|
//根据手机号从baseinfo查对应的信息,如果有则返回,没有则注册
|
|
|
|
|
|
UserBaseInfoEntity baseInfo = baseDao.selectUserByMobile(formDTO.getCustomerId(),formDTO.getMobile()); |
|
|
|
|
|
if (null == baseInfo) { |
|
|
if (null == baseInfo) { |
|
|
//注册
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民信息失败", "获取居民信息失败"); |
|
|
UserEntity userEntity = new UserEntity(); |
|
|
|
|
|
userEntity.setFromApp(AppClientConstant.APP_RESI); |
|
|
|
|
|
userEntity.setFromClient(AppClientConstant.MINI_DING); |
|
|
|
|
|
userEntity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
userDao.insert(userEntity); |
|
|
|
|
|
//信息存入baseinfo
|
|
|
|
|
|
baseInfo = new UserBaseInfoEntity(); |
|
|
|
|
|
baseInfo.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
baseInfo.setUserId(userEntity.getId()); |
|
|
|
|
|
baseInfo.setMobile(formDTO.getMobile()); |
|
|
|
|
|
// todo 没有值 假的
|
|
|
|
|
|
baseInfo.setRealName("h5"); |
|
|
|
|
|
baseInfo.setSurname("h5"); |
|
|
|
|
|
baseInfo.setName("h5"); |
|
|
|
|
|
baseInfo.setNickname("h5"); |
|
|
|
|
|
baseInfo.setHeadImgUrl(""); |
|
|
|
|
|
// todo--------- 以上都是假的
|
|
|
|
|
|
baseInfo.setGender(NumConstant.ZERO_STR); |
|
|
|
|
|
baseDao.insert(baseInfo); |
|
|
|
|
|
|
|
|
|
|
|
result.setEpmetUserId(userEntity.getId()); |
|
|
|
|
|
result.setRegFlag(false); |
|
|
|
|
|
}else { |
|
|
}else { |
|
|
// 更新下user_Base_info信息
|
|
|
|
|
|
// todo h5那边没有传过来信息 所以不需要更新
|
|
|
|
|
|
/*if (StringUtils.isNotBlank(formDTO.getNick()) && StringUtils.isBlank(baseInfo.getRealName())) { |
|
|
|
|
|
baseInfo.setRealName(formDTO.getNick()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getNick()) && StringUtils.isBlank(baseInfo.getSurname())) { |
|
|
|
|
|
baseInfo.setSurname(NameUtils.getSurNameComplex(formDTO.getNick())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getNick()) && StringUtils.isBlank(baseInfo.getName())) { |
|
|
|
|
|
baseInfo.setName(NameUtils.getNameComplex(formDTO.getNick())); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getNick()) && StringUtils.isBlank(baseInfo.getNickname())) { |
|
|
|
|
|
baseInfo.setNickname(formDTO.getNick()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(formDTO.getAvatarUrl()) && StringUtils.isBlank(baseInfo.getHeadImgUrl())) { |
|
|
|
|
|
baseInfo.setHeadImgUrl(formDTO.getAvatarUrl()); |
|
|
|
|
|
} |
|
|
|
|
|
baseDao.updateById(baseInfo); |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
result.setEpmetUserId(baseInfo.getUserId()); |
|
|
result.setEpmetUserId(baseInfo.getUserId()); |
|
|
LambdaQueryWrapper<RegisterRelationEntity> registerWrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
registerWrapper.eq(RegisterRelationEntity::getCustomerId, formDTO.getCustomerId()); |
|
|
|
|
|
registerWrapper.eq(RegisterRelationEntity::getUserId, baseInfo.getUserId()); |
|
|
|
|
|
registerWrapper.eq(RegisterRelationEntity::getFirstRegister, NumConstant.ONE_STR); |
|
|
|
|
|
RegisterRelationEntity registerRelation = registerRelationDao.selectOne(registerWrapper); |
|
|
|
|
|
if (null != registerRelation) { |
|
|
|
|
|
result.setAgencyId(registerRelation.getAgencyId()); |
|
|
|
|
|
result.setGridId(registerRelation.getGridId()); |
|
|
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(registerRelation.getGridId()); |
|
|
|
|
|
if (null == gridInfo) { |
|
|
|
|
|
logger.error(String.format("获取用户注册网格信息为空,userId:%s,gridId:%s", baseInfo.getUserId(), registerRelation.getGridId())); |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取网格信息为空", "获取小程序注册网格信息失败"); |
|
|
|
|
|
} |
|
|
|
|
|
result.setGridName(gridInfo.getGridNamePath()); |
|
|
|
|
|
result.setRegFlag(true); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
distributedLock.unLock(lock); |
|
|
|
|
|
} |
|
|
} |
|
|
return result; |
|
|
return result; |
|
|
} |
|
|
} |
|
|