fengjin
2022-10-21 6e6f4887eaeb046ccdc76a79375a8c7ff47daa96
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
package com.panzhihua.applets.api;
 
import cn.hutool.core.date.DateUtil;
import com.panzhihua.applets.model.dtos.IDTO;
import com.panzhihua.common.controller.BaseController;
import com.panzhihua.common.model.dtos.property.CommonPage;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.property.ComPropertyRepairVO;
import com.panzhihua.common.service.property.PropertyService;
import com.panzhihua.common.utlis.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
@Slf4j
@RestController
@RequestMapping("propertyRepair")
@Api(tags = "物业报修api")
public class ComPropertyRepairApi extends BaseController {
    @Resource
    private PropertyService propertyService;
 
    /**
     * 分页查询所有数据
     * @return 所有数据
     */
    @ApiOperation("小程序列表接口")
    @PostMapping("/queryAll")
    public R selectAll(@RequestBody CommonPage commonPage) {
        commonPage.setUserId(this.getUserId());
        return this.propertyService.comPropertyRepairSelectAll(commonPage);
    }
 
    /**
     * 小程序添加报修
     * @param comPropertyRepairVO
     * @return
     */
    @ApiOperation("小程序添加报修")
    @PostMapping
    public R insert(@RequestBody ComPropertyRepairVO comPropertyRepairVO) {
        comPropertyRepairVO.setCreateTime(DateUtil.date());
        comPropertyRepairVO.setCreateBy(this.getUserId());
        comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.dcl);
        return this.propertyService.comPropertyRepairInsert(comPropertyRepairVO);
    }
 
    /**
     * 修改数据
     *
     * @param comPropertyRepairVO 实体对象
     * @return 修改结果
     */
    @ApiOperation("小程序修改报修")
    @PostMapping("/update")
    public R update(@RequestBody ComPropertyRepairVO comPropertyRepairVO) {
        if(comPropertyRepairVO!=null&& StringUtils.isNotEmpty(comPropertyRepairVO.getFeedbackContent())){
            comPropertyRepairVO.setFeedbackBy(this.getUserId());
            comPropertyRepairVO.setFeedbackTime(DateUtil.date());
            comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.dpj);
        }
        if(comPropertyRepairVO!=null&&StringUtils.isNotEmpty(comPropertyRepairVO.getReplyContent())){
            comPropertyRepairVO.setReplyTime(DateUtil.date());
            comPropertyRepairVO.setRepairStatus(ComPropertyRepairVO.status.yjs);
        }
        return this.propertyService.comPropertyRepairUpdate(comPropertyRepairVO);
    }
 
    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation("详情接口")
    @PostMapping("/detail")
    public R selectDetail(@RequestBody IDTO idto) {
        return this.propertyService.comPropertyRepairSelectOne(idto.getId());
    }
 
    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation("详情接口")
    @GetMapping("/{id}")
    public R selectOne(@PathVariable("id") Long id) {
        return this.propertyService.comPropertyRepairSelectOne(id);
    }
 
    /**
     * 删除数据
     *
     * @param id 主键结合
     * @return 删除结果
     */
    @ApiOperation("删除接口")
    @GetMapping("del")
    public R delete(@RequestParam("id") Long id) {
        return this.propertyService.comPropertyRepairDelete(id);
    }
 
}