huanghongfa
2021-08-19 c40be027ef8068b9a77bb24c94291dee25f563d8
springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/IndexApi.java
@@ -3,6 +3,7 @@
import com.panzhihua.applets.weixin.CheckService;
import com.panzhihua.common.constants.Constants;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.CommonDTO;
import com.panzhihua.common.model.dtos.PageDTO;
import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentDTO;
import com.panzhihua.common.model.dtos.community.PageComActEasyPhotoCommentDTO;
@@ -48,13 +49,11 @@
    @ApiOperation(value = "分页展示社区随手拍",response = ComActEasyPhotoVO.class)
    @PostMapping("pageeasyphoto")
    public R pageEasyPhoto (@RequestBody ComActEasyPhotoVO comActEasyPhotoVO){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long communityId = loginUserInfo.getCommunityId();
        if (null==communityId||0==communityId) {
            return R.fail("用户未绑定社区");
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if(loginUserInfo != null){
            comActEasyPhotoVO.setCommunityId(loginUserInfo.getCommunityId());
            comActEasyPhotoVO.setLogInUserId(loginUserInfo.getUserId());
        }
        comActEasyPhotoVO.setCommunityId(communityId);
        comActEasyPhotoVO.setLogInUserId(loginUserInfo.getUserId());
        return communityService.pageEasyPhotoApplets(comActEasyPhotoVO);
    }
@@ -80,8 +79,12 @@
    @ApiOperation(value = "查询随手拍是否有活动",response = ComActEasyPhotoActivityVO.class)
    @PostMapping("getEasyPhotoActivity")
    public R getEasyPhotoActivity (){
        Long communityId = this.getCommunityId();
    public R getEasyPhotoActivity (@RequestBody CommonDTO commonDTO){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        Long communityId = commonDTO.getCommunityId();
        if(loginUserInfo != null){
            communityId = loginUserInfo.getCommunityId();
        }
        return communityService.getEasyPhotoActivity(communityId);
    }
@@ -89,14 +92,23 @@
    @GetMapping("detaileasyphoto")
    @ApiImplicitParam(name = "id",value = "随手拍主键")
    public R detailEasyPhoto (@RequestParam("id") Long id){
        Long userId = this.getUserId();
        Long userId = 0L;
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if(loginUserInfo != null){
            userId = loginUserInfo.getUserId();
        }
        return communityService.detailEasyPhoto(id,userId);
    }
    @ApiOperation(value = "随手拍--评论--分页查询",response = ComActEasyPhotoCommentVO.class )
    @PostMapping("pagecomacteasyphotocomment")
    public R pageComActEasyPhotoComment (@RequestBody PageComActEasyPhotoCommentDTO pageComActEasyPhotoCommentDTO){
        pageComActEasyPhotoCommentDTO.setUserId(this.getUserId());
        Long userId = 0L;
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if(loginUserInfo != null){
            userId = loginUserInfo.getUserId();
        }
        pageComActEasyPhotoCommentDTO.setUserId(userId);
        return communityService.pageComActEasyPhotoComment(pageComActEasyPhotoCommentDTO);
    }
@@ -134,15 +146,12 @@
    @ApiOperation(value = "分页展示社区微心愿",response = ComActMicroWishVO.class)
    @PostMapping("pagemicrowish")
    public R pageMicroWish (@RequestBody ComActMicroWishVO comActMicroWishVO){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long communityId = loginUserInfo.getCommunityId();
        if (null==communityId||0==communityId) {
            return R.fail("用户未绑定社区");
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if(loginUserInfo != null){
            comActMicroWishVO.setCommunityId(loginUserInfo.getCommunityId());
            comActMicroWishVO.setResponsibleId(loginUserInfo.getUserId());//责任人暂时放登录用户id
        }
        Long userId = loginUserInfo.getUserId();
        comActMicroWishVO.setCommunityId(communityId);
        comActMicroWishVO.setIsApplets(1);
        comActMicroWishVO.setResponsibleId(userId);//责任人暂时放登录用户id
        comActMicroWishVO.setIsPageMyWish(null);
        return communityService.pageMicroWish(comActMicroWishVO);
    }
@@ -176,7 +185,11 @@
    @GetMapping("microwish")
    @ApiImplicitParam(name = "id",value = "微心愿主键")
    public R detailMicroWish (@RequestParam("id")Long id){
        Long userId = this.getUserId();
        Long userId = 0L;
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if(loginUserInfo != null){
            userId = loginUserInfo.getUserId();
        }
        return communityService.detailMicroWish(id,userId);
    }
@@ -193,7 +206,7 @@
    }
    @ApiOperation(value = "首页广告banner",response = ComOpsAdvVO.class)
    @GetMapping("listadvertisement")
    @GetMapping("listadvertisement/noToken")
    public R listAdvertisement (){
        return communityService.listAdvertisement();
    }
@@ -327,4 +340,22 @@
    public R isShop(){
        return R.ok(Constants.IS_SHOP_OPEN);
    }
    @ApiOperation(value = "获取最新活动和用户最新收益",response =ComActEasyPhotoRewardVO.class )
    @GetMapping("getUserReward")
    public R getUserReward(@RequestParam("communityId") Long communityId){
        Long userId = 0L;
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin();
        if(loginUserInfo != null){
            userId = loginUserInfo.getUserId();
            communityId = loginUserInfo.getCommunityId();
        }
        return communityService.getUserReward(userId,communityId);
    }
    @ApiOperation(value = "读取用户随手拍奖励")
    @PostMapping("readUserReward")
    public R readUserReward(){
        return communityService.readUserReward(this.getUserId(),this.getCommunityId());
    }
}