use of com.zyd.blog.business.entity.SocialConfig in project OneBlog by zhangyd-c.
the class SysSocialConfigServiceImpl method getByPlatform.
@Override
public SocialConfig getByPlatform(String platform) {
if (StringUtil.isEmpty(platform)) {
return null;
}
Example example = new Example(SysSocialConfig.class);
Example.Criteria criteria = example.createCriteria();
criteria.andEqualTo("platform", platform.toLowerCase());
SysSocialConfig sysSocialConfig = sysSocialConfigMapper.selectOneByExample(example);
if (null == sysSocialConfig) {
return null;
}
return new SocialConfig(sysSocialConfig);
}
use of com.zyd.blog.business.entity.SocialConfig in project OneBlog by zhangyd-c.
the class OAuthController method renderAuth.
@RequestMapping("/social/{source}")
public ModelAndView renderAuth(@PathVariable("source") String source, HttpServletResponse response, HttpServletRequest request) {
SocialConfig socialConfig = sysSocialConfigService.getByPlatform(source);
if (null == socialConfig) {
throw new ZhydException(source + " 平台的配置尚未完成,暂时不支持登录!");
}
SocialStrategy socialStrategy = new SocialStrategy(japUserService, new JapConfig());
JapResponse japResponse = socialStrategy.authenticate(JapUtil.blogSocialConfig2JapSocialConfig(socialConfig, source), request, response);
if (!japResponse.isSuccess()) {
throw new ZhydException(japResponse.getMessage());
}
if (japResponse.isRedirectUrl()) {
return ResultUtil.redirect((String) japResponse.getData());
} else {
JapUser japUser = (JapUser) japResponse.getData();
User user = (User) japUser.getAdditional();
SessionUtil.setUser(user);
return ResultUtil.redirect("/");
}
}
use of com.zyd.blog.business.entity.SocialConfig in project OneBlog by zhangyd-c.
the class SysSocialConfigServiceImpl method getByPrimaryKey.
@Override
public SocialConfig getByPrimaryKey(Long primaryKey) {
Assert.notNull(primaryKey, "This argument is required; it must not be null");
SysSocialConfig entity = sysSocialConfigMapper.selectByPrimaryKey(primaryKey);
return null == entity ? null : new SocialConfig(entity);
}
use of com.zyd.blog.business.entity.SocialConfig in project OneBlog by zhangyd-c.
the class SysSocialConfigServiceImpl method getByClientId.
@Override
public SocialConfig getByClientId(String clientId) {
Assert.notNull(clientId, "This argument is required; it must not be null");
SysSocialConfig entity = sysSocialConfigMapper.getByClientId(clientId);
return null == entity ? null : new SocialConfig(entity);
}
use of com.zyd.blog.business.entity.SocialConfig in project OneBlog by zhangyd-c.
the class SysSocialConfigServiceImpl method findPageBreakByCondition.
@Override
public PageInfo<SocialConfig> findPageBreakByCondition(SocialConfigConditionVO vo) {
PageHelper.startPage(vo.getPageNumber(), vo.getPageSize());
List<SysSocialConfig> list = sysSocialConfigMapper.findPageBreakByCondition(vo);
if (CollectionUtils.isEmpty(list)) {
return null;
}
PageInfo bean = new PageInfo<SysSocialConfig>(list);
bean.setList(list.stream().map(SocialConfig::new).collect(Collectors.toList()));
return bean;
}
Aggregations