DESKTOP-71BH0QO\L、ming
2021-04-20 26cd8c7b2bc7a725a3de28d3ed883a6f54da84f1
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
package com.panzhihua.applets.api;
 
import com.panzhihua.applets.weixin.CheckService;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.community.ComOpsHouseDTO;
import com.panzhihua.common.model.dtos.community.PageComOpsHouseDTO;
import com.panzhihua.common.model.vos.LoginUserInfoVO;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComOpsHouseUndercarriageVO;
import com.panzhihua.common.model.vos.community.ComOpsHouseVO;
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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: 2021-01-22 15:30
 **/
@Slf4j
@Api(tags = {"房屋租售"})
@RestController
@RequestMapping("/")
public class HouseApi extends BaseController {
    @Resource
    private CommunityService communityService;
    @Resource
    private CheckService checkService;
 
 
    @ApiOperation(value = "房屋租售-新增")
    @PostMapping("house")
    public R addHouse(@RequestBody @Validated(AddGroup.class) ComOpsHouseDTO comOpsHouseDTO) {
//        微信内容审核
        String introduction = comOpsHouseDTO.getIntroduction();
        if (!checkService.checkMessage(introduction)) {
            return R.fail("内容违规");
        }
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long userId = loginUserInfo.getUserId();
        Long communityId = loginUserInfo.getCommunityId();
        comOpsHouseDTO.setUserId(userId);
        comOpsHouseDTO.setCommunityId(communityId);
        comOpsHouseDTO.setUserType(1);
        return communityService.addOpsHouse(comOpsHouseDTO);
    }
 
 
    @ApiOperation(value = "房屋租售-分页查询",response = ComOpsHouseVO.class)
    @PostMapping("pagehouse")
    public R pageHouse(@RequestBody PageComOpsHouseDTO pageComOpsHouseDTO) {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Integer isMy = pageComOpsHouseDTO.getIsMy();
        if (null!=isMy&&isMy.intValue()==1) {
            pageComOpsHouseDTO.setUserId(loginUserInfo.getUserId());
        }
        return communityService.pageOpsHouse(pageComOpsHouseDTO);
    }
 
 
    @ApiOperation(value = "房屋租售-详情",response = ComOpsHouseVO.class)
    @GetMapping("house")
    @ApiImplicitParam(name = "id",value = "房屋租售主键",required = true)
    public R detailHouse(@RequestParam("id") Long id) {
        return communityService.detailOpsHouse(id);
    }
 
 
    @ApiOperation(value = "房屋租售-修改")
    @PostMapping("putHouse")
    public R updateHouse(@RequestBody @Validated(PutGroup.class) ComOpsHouseVO comOpsHouseVO) {
        return communityService.putOpsHouseByApplets(comOpsHouseVO);
    }
 
    @ApiOperation(value = "房屋租售-删除")
    @GetMapping("delHouse")
    @ApiImplicitParam(name = "id",value = "房屋租售主键",required = true)
    public R delHouse(@RequestParam("id") Long id) {
        return communityService.deleteOpsHouse(id);
    }
 
    @ApiOperation(value = "房屋租售-上下架")
    @PostMapping("undercarriageHouse")
    public R undercarriageHouse(@RequestBody @Validated(PutGroup.class) ComOpsHouseUndercarriageVO comOpsHouseVO) {
        return communityService.undercarriageHouse(comOpsHouseVO);
    }
 
 
 
}