java110
2020-09-13 e5fc266e1e43423dc5dcbe56f7011eb4f852d4a8
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
package com.java110.user.api;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.rentingAppointment.RentingAppointmentDto;
import com.java110.po.rentingAppointment.RentingAppointmentPo;
import com.java110.user.bmo.rentingAppointment.IDeleteRentingAppointmentBMO;
import com.java110.user.bmo.rentingAppointment.IGetRentingAppointmentBMO;
import com.java110.user.bmo.rentingAppointment.ISaveRentingAppointmentBMO;
import com.java110.user.bmo.rentingAppointment.IUpdateRentingAppointmentBMO;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
/**
 * 租赁 预约接口类 controller
 *
 * add by 吴学文
 *
 */
@RestController
@RequestMapping(value = "/rentingAppointment")
public class RentingAppointmentApi {
 
    @Autowired
    private ISaveRentingAppointmentBMO saveRentingAppointmentBMOImpl;
    @Autowired
    private IUpdateRentingAppointmentBMO updateRentingAppointmentBMOImpl;
    @Autowired
    private IDeleteRentingAppointmentBMO deleteRentingAppointmentBMOImpl;
 
    @Autowired
    private IGetRentingAppointmentBMO getRentingAppointmentBMOImpl;
 
    /**
     * 微信保存消息模板
     *
     * @param reqJson
     * @return
     * @serviceCode /rentingAppointment/saveRentingAppointment
     * @path /app/rentingAppointment/saveRentingAppointment
     */
    @RequestMapping(value = "/saveRentingAppointment", method = RequestMethod.POST)
    public ResponseEntity<String> saveRentingAppointment(@RequestBody JSONObject reqJson) {
 
        Assert.hasKeyAndValue(reqJson, "tenantName", "请求报文中未包含tenantName");
        Assert.hasKeyAndValue(reqJson, "tenantSex", "请求报文中未包含tenantSex");
        Assert.hasKeyAndValue(reqJson, "tenantTel", "请求报文中未包含tenantTel");
        Assert.hasKeyAndValue(reqJson, "appointmentTime", "请求报文中未包含appointmentTime");
 
 
        RentingAppointmentPo rentingAppointmentPo = BeanConvertUtil.covertBean(reqJson, RentingAppointmentPo.class);
        return saveRentingAppointmentBMOImpl.save(rentingAppointmentPo);
    }
 
    /**
     * 微信修改消息模板
     *
     * @param reqJson
     * @return
     * @serviceCode /rentingAppointment/updateRentingAppointment
     * @path /app/rentingAppointment/updateRentingAppointment
     */
    @RequestMapping(value = "/updateRentingAppointment", method = RequestMethod.POST)
    public ResponseEntity<String> updateRentingAppointment(@RequestBody JSONObject reqJson) {
 
        Assert.hasKeyAndValue(reqJson, "tenantName", "请求报文中未包含tenantName");
        Assert.hasKeyAndValue(reqJson, "tenantSex", "请求报文中未包含tenantSex");
        Assert.hasKeyAndValue(reqJson, "tenantTel", "请求报文中未包含tenantTel");
        Assert.hasKeyAndValue(reqJson, "appointmentTime", "请求报文中未包含appointmentTime");
        Assert.hasKeyAndValue(reqJson, "appointmentId", "appointmentId不能为空");
 
 
        RentingAppointmentPo rentingAppointmentPo = BeanConvertUtil.covertBean(reqJson, RentingAppointmentPo.class);
        return updateRentingAppointmentBMOImpl.update(rentingAppointmentPo);
    }
 
    /**
     * 微信删除消息模板
     *
     * @param reqJson
     * @return
     * @serviceCode /rentingAppointment/deleteRentingAppointment
     * @path /app/rentingAppointment/deleteRentingAppointment
     */
    @RequestMapping(value = "/deleteRentingAppointment", method = RequestMethod.POST)
    public ResponseEntity<String> deleteRentingAppointment(@RequestBody JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "communityId", "小区ID不能为空");
 
        Assert.hasKeyAndValue(reqJson, "appointmentId", "appointmentId不能为空");
 
 
        RentingAppointmentPo rentingAppointmentPo = BeanConvertUtil.covertBean(reqJson, RentingAppointmentPo.class);
        return deleteRentingAppointmentBMOImpl.delete(rentingAppointmentPo);
    }
 
    /**
     * 微信删除消息模板
     *
     * @param storeId 商户ID
     * @return
     * @serviceCode /rentingAppointment/queryRentingAppointment
     * @path /app/rentingAppointment/queryRentingAppointment
     */
    @RequestMapping(value = "/queryRentingAppointment", method = RequestMethod.GET)
    public ResponseEntity<String> queryRentingAppointment(@RequestHeader(value = "store-id") String storeId,
                                                          @RequestParam(value = "page") int page,
                                                          @RequestParam(value = "row") int row) {
        RentingAppointmentDto rentingAppointmentDto = new RentingAppointmentDto();
        rentingAppointmentDto.setPage(page);
        rentingAppointmentDto.setRow(row);
        rentingAppointmentDto.setStoreId(storeId);
        return getRentingAppointmentBMOImpl.get(rentingAppointmentDto);
    }
}