package com.panzhihua.applets.api;
|
|
import com.panzhihua.common.model.vos.community.ComActActivityVO;
|
import com.panzhihua.common.service.community.CommunityService;
|
import com.panzhihua.common.service.user.UserService;
|
import com.panzhihua.common.controller.BaseController;
|
import com.panzhihua.common.exceptions.UnAuthenticationException;
|
import com.panzhihua.common.model.vos.LoginUserInfoVO;
|
import com.panzhihua.common.model.vos.R;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.util.ObjectUtils;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
/**
|
* @program: springcloud_k8s_panzhihuazhihuishequ
|
* @description: 用户
|
* @author: huang.hongfa weixin hhf9596 qq 959656820
|
* @create: 2020-11-24 12:03
|
**/
|
@RestController
|
@RequestMapping("/user/")
|
@Api(tags = {"我的模块"})
|
public class UserApi extends BaseController {
|
@Resource
|
private UserService userService;
|
@Resource
|
private CommunityService communityService;
|
|
@ApiOperation(value = "当前登录用户信息",response = LoginUserInfoVO.class)
|
@GetMapping("info")
|
public R getUserInfo(){
|
Long userId = this.getUserId();
|
boolean empty = ObjectUtils.isEmpty(userId);
|
if (empty) {
|
throw new UnAuthenticationException();
|
}
|
R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + "");
|
return r;
|
}
|
|
@ApiOperation(value = "分页展示我的活动",response = ComActActivityVO.class)
|
@GetMapping("pagemyactivity")
|
public R pageMyActivity(@RequestBody ComActActivityVO comActActivityVO){
|
Long userId = this.getUserId();
|
// todo 我的活动包括普通社区活动、志愿者活动、党建活动
|
comActActivityVO.setSponsorId(userId);//登录人id 暂时存入负责人字段
|
R r = communityService.pageMyActivity(comActActivityVO);
|
return r;
|
}
|
}
|