|
|
@ -722,4 +722,39 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem |
|
|
|
return new Result<EpdcUserRegisterInfoResultDTO>().ok(resultDto); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @return com.elink.esua.epdc.commons.tools.utils.Result<com.elink.esua.epdc.dto.UserDTO> |
|
|
|
* @Author yinzuomei |
|
|
|
* @Description 获取用户信息 合并上面的getByUnionId、getForLogin方法 |
|
|
|
* @Date 2019/12/7 13:58 |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result<UserDTO> queryUserDto(EpdcAppQueryUserInfoFormDTO formDTO) { |
|
|
|
if (!StringUtils.isNotBlank(formDTO.getUnionId()) && !StringUtils.isNotBlank(formDTO.getOpenId())) { |
|
|
|
return new Result<UserDTO>().error("openId、unionId不能同时为空"); |
|
|
|
} |
|
|
|
QueryWrapper<UserEntity> wrapper = new QueryWrapper<>(); |
|
|
|
wrapper.eq(StringUtils.isNotBlank(formDTO.getUnionId()), UserFieldConsant.WX_UNION_ID, formDTO.getUnionId()) |
|
|
|
.eq(StringUtils.isNotBlank(formDTO.getOpenId()), UserFieldConsant.WX_OPEN_ID, formDTO.getOpenId()) |
|
|
|
.orderByDesc(FieldConstant.CREATED_TIME); |
|
|
|
UserEntity userEntity = this.baseDao.selectOne(wrapper); |
|
|
|
|
|
|
|
if (null != userEntity) { |
|
|
|
QueryWrapper<UserGridRelationEntity> ugWrapper = new QueryWrapper<>(); |
|
|
|
ugWrapper.eq(UserFieldConsant.USER_ID, userEntity.getId()) |
|
|
|
.orderByDesc(UserFieldConsant.SWITCHED_TIME); |
|
|
|
List<UserGridRelationDTO> gridRelations = userGridRelationService.listUserGrid(userEntity.getId()); |
|
|
|
if (CollUtil.isNotEmpty(gridRelations)) { |
|
|
|
UserDTO dto = ConvertUtils.sourceToTarget(userEntity, UserDTO.class); |
|
|
|
dto.setGridId(gridRelations.get(NumConstant.ZERO).getGridId()); |
|
|
|
dto.setGrid(gridRelations.get(NumConstant.ZERO).getGrid()); |
|
|
|
return new Result<UserDTO>().ok(dto); |
|
|
|
} |
|
|
|
} else { |
|
|
|
return new Result<UserDTO>().error("没有找到用户信息"); |
|
|
|
} |
|
|
|
return new Result<>(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|