huliguo
2 天以前 5d7b65670282a4fad015e37d567cfa171b162052
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
package com.ruoyi.web.controller.errand;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.errand.domain.Community;
import com.ruoyi.errand.object.dto.sys.*;
import com.ruoyi.errand.object.vo.app.CommunityListVO;
import com.ruoyi.errand.object.vo.sys.*;
import com.ruoyi.errand.service.CommunityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
 
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
 
import javax.validation.Valid;
import java.util.List;
 
 
@RestController
@RequestMapping(value = "/app/community")
@Api(value = "小区信息", tags = "小区信息操作控制器")
@Slf4j
public class CommunityController {
    @Autowired
    private CommunityService communityService;
 
 
 
    /**
     * 区域内的小区列表
     */
    @GetMapping("/getCommunity")
    @ApiOperation(value = "区域内的小区列表",tags = "app用户端-小区")
    public R<List<CommunityListVO>> getCommunity(@RequestParam(value = "regionId") Integer regionId) {
        return communityService.getCommunity(regionId);
    }
 
    /**
     * 获取所有小区列表
     */
    @GetMapping("/getTotalCommunityList")
    @PreAuthorize("@ss.hasPermi('system:index:statistics')")
    @ApiOperation(value = "获取所有小区列表(开通的小区总数取列表大小吧)",tags = "系统后台-首页")
    public R<List<CommunityListVO>> getTotalCommunityList() {
        return communityService.getTotalCommunityList();
    }
 
    /**
     * 加载未绑定跑腿员的小区  权限设置
     */
    @GetMapping("/getAllCommunityList")
    @PreAuthorize("@ss.hasPermi('system:appuser:list')")
    @ApiOperation(value = "跑腿员管理-加载未绑定跑腿员的小区", tags = "系统后台-跑腿员管理")
    public R<List<AllCommunityListVO>> getAllCommunityList() {
        return R.ok(communityService.getAllCommunityList());
    }
 
    /**
     * 小区管理列表查看 权限设置
     */
    @PostMapping("/list")
    @PreAuthorize("@ss.hasPermi('system:community:list')")
    @ApiOperation(value = "小区管理-分页列表", tags = "系统后台-小区管理")
    public R<IPage<CommunityPageListVO>> getCommunityPageList(@RequestBody @Valid CommunityPageListDTO communityPageListDTO) {
        return R.ok(communityService.getCommunityPageList(communityPageListDTO));
    }
 
 
    /**
     * 添加小区 权限设置
     * 判断小区是否存在
     * 判断跑腿员是否存在
     * 判断跑腿员是否绑定
     *
     */
    @PostMapping("/add")
    @PreAuthorize("@ss.hasPermi('system:community:list')")
    @ApiOperation(value = "小区管理-添加", tags = "系统后台-小区管理")
    public R<Void> add(@RequestBody @Valid AddCommunityDTO addCommunityDTO) {
        communityService.add(addCommunityDTO);
        return R.ok();
    }
 
    /**
     * 编辑 权限设置
     */
    @PutMapping("/edit")
    @PreAuthorize("@ss.hasPermi('system:community:list')")
    @ApiOperation(value = "小区管理-编辑", tags = "系统后台-小区管理")
    public R<Void> edit(@RequestBody @Valid EditCommunityDTO editCommunityDTO) {
        communityService.edit(editCommunityDTO);
        return R.ok();
    }
 
    /**
     * 删除 权限设置
     * 删除小区 跑腿员 app用户
     */
    @DeleteMapping("/delete")
    @PreAuthorize("@ss.hasPermi('system:community:list')")
    @ApiOperation(value = "小区管理-删除", tags = "系统后台-小区管理")
    public R<Void> delete(@RequestParam("id")Integer id) {
        communityService.delete(id);
        return R.ok();
    }
    /**
     * 冻结 权限设置
     */
    @PutMapping("/froze")
    @PreAuthorize("@ss.hasPermi('system:community:list')")
    @ApiOperation(value = "小区管理-冻结/解冻", tags = "系统后台-小区管理")
    public R<Void> froze(@RequestParam("id")Integer id) {
        communityService.froze(id);
        return R.ok();
    }
    /**
     * 查看详情 权限设置
     */
 
    @GetMapping("/detail")
    @PreAuthorize("@ss.hasPermi('system:community:list')")
    @ApiOperation(value = "小区管理-查看详情", tags = "系统后台-小区管理")
    public R<CommunitySysDetailVO> detail(@RequestParam("id") Integer id) {
        return R.ok(communityService.detail(id));
    }
}