package com.panzhihua.applets.api;
|
|
|
import com.panzhihua.common.controller.BaseController;
|
import com.panzhihua.common.model.dtos.community.social.PageProjectSignListDTO;
|
import com.panzhihua.common.model.dtos.property.CommonPage;
|
import com.panzhihua.common.model.vos.LoginUserInfoVO;
|
import com.panzhihua.common.model.vos.R;
|
import com.panzhihua.common.model.vos.community.ComActSocialOrgVO;
|
import com.panzhihua.common.model.vos.community.social.SocialProjectVO;
|
import com.panzhihua.common.service.community.CommunityService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiOperation;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.web.bind.annotation.*;
|
|
import javax.annotation.Resource;
|
import javax.validation.Valid;
|
|
import static java.util.Objects.isNull;
|
import static java.util.Objects.nonNull;
|
|
/**
|
* 三社联动项目表(ComActSocialProject)表控制层
|
*
|
* @author zzj
|
* @since 2021-12-22 14:02:48
|
*/
|
@Slf4j
|
@Api(tags = {"项目管理"})
|
@RestController
|
@RequestMapping("comActSocialProject")
|
public class ComActSocialProjectApi extends BaseController {
|
/**
|
* 服务对象
|
*/
|
@Resource
|
private CommunityService communityService;
|
|
/**
|
* 分页查询所有数据
|
*
|
* @param commonPage 查询实体
|
* @return 所有数据
|
*/
|
@ApiOperation(value = "分页查询接口",response =SocialProjectVO.class )
|
@PostMapping("queryAll")
|
public R selectAll(@RequestBody CommonPage commonPage) {
|
LoginUserInfoVO loginUserInfoSureNoLogin = this.getLoginUserInfoSureNoLogin();
|
if (nonNull(loginUserInfoSureNoLogin)) {
|
commonPage.setCommunityId(loginUserInfoSureNoLogin.getCommunityId());
|
commonPage.setStreetId(loginUserInfoSureNoLogin.getStreetId());
|
} else if (isNull(commonPage.getCommunityId())) {
|
return R.fail("缺少社区id");
|
}
|
commonPage.setParamId2(0);
|
// commonPage.setIsPublicity(1);
|
return communityService.selectAllComActSocialProject(commonPage);
|
}
|
|
/**
|
* 平台详情接口
|
*
|
* @param id 主键
|
* @return 单条数据
|
*/
|
@ApiOperation(value = "平台详情接口",response =SocialProjectVO.class )
|
@GetMapping("{id}")
|
public R selectOne(@PathVariable("id") Long id) {
|
LoginUserInfoVO userInfo = this.getLoginUserInfoSureNoLogin();
|
Long userId = null;
|
if (nonNull(userInfo)) {
|
userId = userInfo.getUserId();
|
}
|
return communityService.getAppletComActSocialProject(id, userId);
|
}
|
/**
|
* 根据项目id分页获取关联项目
|
*/
|
@ApiOperation(value = "根据项目id分页获取关联项目")
|
@PostMapping("/getRelation")
|
public R getRelation(@RequestBody CommonPage commonPage){
|
return communityService.getRelationComActSocialProject(commonPage);
|
}
|
|
/**
|
* 新增数据
|
*
|
* @param socialProjectVO 实体对象
|
* @return 新增结果
|
*/
|
@ApiOperation(value = "新增数据")
|
@PostMapping
|
public R insert(@RequestBody SocialProjectVO socialProjectVO) {
|
return communityService.insertComActSocialProject(socialProjectVO);
|
}
|
|
/**
|
* 修改数据
|
*
|
* @param socialProjectVO 实体对象
|
* @return 修改结果
|
*/
|
@ApiOperation(value = "修改数据")
|
@PostMapping("/update")
|
public R update(@RequestBody SocialProjectVO socialProjectVO) {
|
return communityService.updateComActSocialProject(socialProjectVO);
|
}
|
|
/**
|
* 删除数据
|
*
|
* @param id 主键结合
|
* @return 删除结果
|
*/
|
@ApiOperation(value = "删除数据")
|
@GetMapping("del")
|
public R delete(@RequestParam("id") Long id) {
|
return communityService.deleteComActSocialProject(id);
|
}
|
|
@ApiOperation(value = "项目公开报名")
|
@ApiImplicitParam(name = "projectId", value = "项目id", required = true)
|
@GetMapping("/sign")
|
public R signProject(@RequestParam("projectId") Long projectId) {
|
return communityService.signProject(projectId, this.getUserId());
|
}
|
|
@ApiOperation(value = "分页查询项目报名列表", response = ComActSocialOrgVO.class)
|
@PostMapping("signList")
|
public R pageProjectSignList(@RequestBody @Valid PageProjectSignListDTO pageProjectSignListDTO) {
|
return communityService.pageProjectSignList(pageProjectSignListDTO);
|
}
|
}
|