Search in sources :

Example 1 with UserCenterInfoCountVO

use of com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO 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 UserCenterInfoCountVO

use of com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO in project haha by hahafreeasair666.

the class ApiTests method test.

@Test
public void test() {
    /*UserCenterInfoCountVO userInfoCount = userInfoService.getUserInfoCount(1);
        System.out.println(userInfoCount);*/
    /* userInfoBORepository.deleteAll();
        userBORepository.deleteAll();*/
    PageableVo pageableVo = new PageableVo();
    // pageableVo.setSize(1);
    // pageableVo.setPage(3);
    pageableVo.setSort(new Sort(Sort.Direction.DESC, "createTime"));
    newsCommentService.getNewsCommentList(5, pageableVo, null);
}
Also used : Sort(org.springframework.data.domain.Sort) PageableVo(com.ch999.haha.common.PageableVo) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with UserCenterInfoCountVO

use of com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO in project haha by hahafreeasair666.

the class UserInfoServiceImpl method getUserCenterInfo.

@Override
public OtherCenterVO getUserCenterInfo(Integer userId, Integer loginUserId) {
    OtherCenterVO userCenterVO = new OtherCenterVO();
    UserCenterInfoCountVO userInfoCount = getUserInfoCount(userId);
    userCenterVO.setUserId(userId);
    userCenterVO.setFollows(userInfoCount.getFollow());
    userCenterVO.setFans(userInfoCount.getFans());
    UserInfoBO one = userInfoBORepository.findOne(userId);
    if (one == null) {
        return null;
    }
    userCenterVO.setAvatar(one.getUserInfo().getPicPath());
    userCenterVO.setDescription(one.getUserInfo().getAutograph());
    userCenterVO.setMyCredit(one.getCreditInfo().get("creditNum") != null ? (int) one.getCreditInfo().get("creditNum") : 0);
    userCenterVO.setUserName(one.getUserInfo().getUsername());
    // 组装是否已关注信息
    if (loginUserId != null) {
        Wrapper<UserFans> wrapper = new EntityWrapper<>();
        wrapper.eq("userid1", loginUserId);
        wrapper.eq("userid2", userId);
        if (userFansService.selectCount(wrapper) == 0 && !userId.equals(loginUserId)) {
            userCenterVO.setIsCanFollow(true);
        } else {
            userCenterVO.setIsCanFollow(false);
        }
    } else {
        userCenterVO.setIsCanFollow(true);
    }
    return userCenterVO;
}
Also used : UserCenterInfoCountVO(com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO) EntityWrapper(com.baomidou.mybatisplus.mapper.EntityWrapper) UserFans(com.ch999.haha.admin.entity.UserFans) OtherCenterVO(com.ch999.haha.admin.vo.OtherCenterVO) UserInfoBO(com.ch999.haha.admin.document.redis.UserInfoBO)

Aggregations

UserCenterInfoCountVO (com.ch999.haha.admin.vo.mappervo.UserCenterInfoCountVO)2 EntityWrapper (com.baomidou.mybatisplus.mapper.EntityWrapper)1 UserInfoBO (com.ch999.haha.admin.document.redis.UserInfoBO)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 PageableVo (com.ch999.haha.common.PageableVo)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 Sort (org.springframework.data.domain.Sort)1