use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserInfoServiceImpl method getMyCenterInfo.
@Override
public MyCenterVO getMyCenterInfo(UserInfoBO userInfo) {
MyCenterVO userCenterVO = new MyCenterVO();
UserCenterInfoCountVO userInfoCount = getUserInfoCount(userInfo.getUserInfo().getId());
userCenterVO.setUserName(userInfo.getUserInfo().getUsername());
userCenterVO.setFans(userInfoCount.getFans());
userCenterVO.setFollows(userInfoCount.getFollow());
userCenterVO.setMyCollection(userInfoCount.getCollections());
userCenterVO.setMyAdoption(userInfoCount.getMyAdoption());
userCenterVO.setAdoptionRequest(userInfoCount.getAdoptionRequest());
userCenterVO.setUserId(userInfoCount.getUserId());
userCenterVO.setZan(userInfoCount.getZan());
userCenterVO.setDescription(userInfo.getUserInfo().getAutograph());
userCenterVO.setMyCredit(userInfo.getCreditInfo().get("creditNum") != null ? (int) userInfo.getCreditInfo().get("creditNum") : 0);
userCenterVO.setAvatar(userInfo.getUserInfo().getPicPath());
userCenterVO.setMyRelease(userInfoCount.getReleases());
userCenterVO.setAdoptionPerson(userInfoCount.getAdoptionPerson());
return userCenterVO;
}
use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class NewsApi method addNews.
// todo 以下是新闻相关
@PostMapping("/addNews/v1")
public Result<Map<String, Object>> addNews(AddNewsVO addNewsVO, HttpServletRequest request) {
UserInfoBO loginUser = userComponent.getLoginUser();
if (loginUser.getId() == null) {
return Result.error("error", "请登录后再操作");
}
if ((int) loginUser.getCreditInfo().get("creditNum") < 70) {
return Result.error("error", "对不起信誉积分不足不能发布公告");
}
String ip = HttpClientUtil.getIpAddr(request);
Integer integer = newsService.addNews(addNewsVO, loginUser.getId(), ip);
if (integer != null) {
Map<String, Object> map = new HashMap<>();
map.put("newsId", integer);
return Result.success(map);
}
return Result.error("error", "添加失败");
}
use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserInfoApi method getAdoptionPersonList.
@GetMapping("/getAdoptionPersonList/v1")
public Result<PageVO<AdoptionRequestVO>> getAdoptionPersonList(Page<AdoptionRequestVO> page) {
UserInfoBO loginUser = userComponent.getLoginUser();
if (loginUser.getId() == null) {
return Result.unlogin("unLogin", "请登陆后再查看信息", null);
}
Page<AdoptionRequestVO> adoptionRequestList = adoptionRequestService.getAdoptionRequestList(page, loginUser.getId(), false);
PageVO<AdoptionRequestVO> pageVO = new PageVO<>();
pageVO.setCurrentPage(page.getCurrent());
pageVO.setTotalPage((int) Math.ceil(page.getTotal() / (double) page.getSize()));
pageVO.setList(adoptionRequestList.getRecords());
return Result.success(pageVO);
}
use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserInfoApi method getAdoptionRequest.
// 想领养的人
@GetMapping("/getAdoptionRequest/v1")
public Result<PageVO<AdoptionRequestVO>> getAdoptionRequest(Page<AdoptionRequestVO> page) {
UserInfoBO loginUser = userComponent.getLoginUser();
if (loginUser.getId() == null) {
return Result.unlogin("unLogin", "请登陆后再查看信息", null);
}
Page<AdoptionRequestVO> adoptionRequestList = adoptionRequestService.getAdoptionRequestList(page, loginUser.getId(), true);
PageVO<AdoptionRequestVO> pageVO = new PageVO<>();
pageVO.setCurrentPage(page.getCurrent());
pageVO.setTotalPage((int) Math.ceil(page.getTotal() / (double) page.getSize()));
pageVO.setList(adoptionRequestList.getRecords());
return Result.success(pageVO);
}
use of com.ch999.haha.admin.document.redis.UserInfoBO in project haha by hahafreeasair666.
the class UserInfoApi method handleAdoptionInfo.
// 确认收养
@PostMapping("/handleAdoptionInfo/v1")
public Result<String> handleAdoptionInfo(Integer newsId, Integer userId) {
UserInfoBO loginUser = userComponent.getLoginUser();
if (loginUser.getId() == null) {
return Result.unlogin("unLogin", "请登陆后再处理信息", null);
} else if (newsId == null) {
return Result.error("error", "请选择你要处理的领养信息");
} else if (userId == null) {
return Result.error("error", "请选择你要确认领养的用户");
}
Boolean aBoolean = adoptionRequestService.handleAdoptionInfo(loginUser.getId(), newsId, userId);
if (aBoolean == null) {
return Result.error("error", "操作失败,改宠物已被领养,或该用户没有发起收养请求,或您无权操作此申请");
} else if (aBoolean) {
return Result.success();
}
return Result.error("error", "处理失败请联系开发人员检查代码");
}
Aggregations