New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.model.dtos.community.PageVolunteerDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.service.community.CommunityService; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import com.panzhihua.common.validated.PageGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 社区服务 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2020-12-10 10:04 |
| | | **/ |
| | | @RestController |
| | | @RequestMapping("/community/") |
| | | @Api(tags = {"社区服务"}) |
| | | public class CommunityApi extends BaseController { |
| | | @Resource |
| | | private CommunityService communityService; |
| | | |
| | | @ApiOperation(value = "分页获取社区动态",response = ComActDynVO.class) |
| | | @PostMapping("pagedynamic") |
| | | public R pageDynamic(@RequestBody ComActDynVO comActDynVO){ |
| | | Long communityId = this.getCommunityId(); |
| | | comActDynVO.setCommunityId(communityId); |
| | | comActDynVO.setIsTopping(null); |
| | | comActDynVO.setStatus(null); |
| | | return communityService.pageDynamic(comActDynVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区动态详情",response = ComActDynVO.class) |
| | | @GetMapping("detaildynamic") |
| | | @ApiImplicitParam(name ="id",value = "社区动态主键",required = true) |
| | | public R detailDynamic(@RequestParam("id") Long id){//todo 增加微信分享接口 |
| | | return communityService.detailDynamic(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询社区活动",response = ComActActivityVO.class) |
| | | @PostMapping("pageactivity") |
| | | public R pageActivity(@RequestBody ComActActivityVO comActActivityVO){ |
| | | Long communityId = this.getCommunityId(); |
| | | comActActivityVO.setCommunityId(communityId); |
| | | return communityService.pageActivity(comActActivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "社区活动/志愿者活动详情",response = ComActActivityVO.class) |
| | | @GetMapping("detailactivity") |
| | | @ApiImplicitParam(name ="id",value = "社区活动主键",required = true) |
| | | public R detailActivity(@RequestParam("id") Long id){ |
| | | Long userId = this.getUserId(); |
| | | return communityService.detailActivity(id,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "报名/取消报名社区活动") |
| | | @PutMapping("signactivity") |
| | | public R signActivity(@RequestBody @Validated(AddGroup.class) SignactivityVO signactivityVO){ |
| | | Long userId = this.getUserId(); |
| | | signactivityVO.setUserId(userId); |
| | | return communityService.signActivity(signactivityVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "活动人员列表",response = ActivitySignVO.class) |
| | | @ApiImplicitParam(name ="id",value = "社区活动主键",required = true) |
| | | @GetMapping("listactivitysign") |
| | | public R listActivitySign(@RequestParam("id") Long id){ |
| | | ActivitySignVO activitySignVO=new ActivitySignVO(); |
| | | activitySignVO.setActivityId(id); |
| | | return communityService.listActivitySign(activitySignVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增社区动态浏览记录") |
| | | @PostMapping("dynamicuser") |
| | | public R addDynamicUser(@RequestBody ComActDynVO comActDynVO){ |
| | | Long id = comActDynVO.getId(); |
| | | if (null==id||id==0) { |
| | | return R.fail("社区动态不存在"); |
| | | } |
| | | Long userId = this.getUserId(); |
| | | return communityService.addDynamicUser(id,userId); |
| | | } |
| | | |
| | | @ApiOperation(value = "志愿者申请") |
| | | @PostMapping("volunteer") |
| | | public R addVolunteer(@RequestBody @Validated(AddGroup.class) ComMngVolunteerMngVO comMngVolunteerMngVO){ |
| | | comMngVolunteerMngVO.setState(1); |
| | | return communityService.addVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页查询志愿者团队") |
| | | @PostMapping("pagevolunteer") |
| | | public R pageVolunteer(@RequestBody @Validated(PageGroup.class) PageVolunteerDTO pageVolunteerDTO){ |
| | | Long communityId = this.getCommunityId(); |
| | | ComMngVolunteerMngVO comMngVolunteerMngVO=new ComMngVolunteerMngVO(); |
| | | comMngVolunteerMngVO.setCommunityId(communityId); |
| | | comMngVolunteerMngVO.setPageNum(pageVolunteerDTO.getPageNum()); |
| | | comMngVolunteerMngVO.setPageSize(pageVolunteerDTO.getPageSize()); |
| | | return communityService.pageVolunteer(comMngVolunteerMngVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "志愿者详情",response = ComMngVolunteerMngAppletsVO.class) |
| | | @GetMapping("volunteer") |
| | | public R detailVolunteer(@RequestParam("id") Long id){ |
| | | return communityService.detailVolunteer(id); |
| | | } |
| | | |
| | | |
| | | } |
| | | |