Search in sources :

Example 1 with UserInfoBO

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;
}
Also used : MyCenterVO(com.ch999.haha.admin.vo.MyCenterVO) UserCenterInfoCountVO(com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO)

Example 2 with UserInfoBO

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", "添加失败");
}
Also used : HashMap(java.util.HashMap) UserInfoBO(com.ch999.haha.admin.document.redis.UserInfoBO) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 3 with UserInfoBO

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);
}
Also used : UserInfoBO(com.ch999.haha.admin.document.redis.UserInfoBO)

Example 4 with UserInfoBO

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);
}
Also used : UserInfoBO(com.ch999.haha.admin.document.redis.UserInfoBO)

Example 5 with UserInfoBO

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", "处理失败请联系开发人员检查代码");
}
Also used : UserInfoBO(com.ch999.haha.admin.document.redis.UserInfoBO)

Aggregations

UserInfoBO (com.ch999.haha.admin.document.redis.UserInfoBO)12 UserInfo (com.ch999.haha.admin.entity.UserInfo)4 UserCenterInfoCountVO (com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO)2 EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)1 Imgs (com.ch999.haha.admin.entity.Imgs)1 UserFans (com.ch999.haha.admin.entity.UserFans)1 MyCenterVO (com.ch999.haha.admin.vo.MyCenterVO)1 OtherCenterVO (com.ch999.haha.admin.vo.OtherCenterVO)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1