mitao
2025-02-24 879ce4e66b36daf44f79b17eb02d3578148e4545
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
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);
    }
}