java110
2020-12-20 3e0fbd3a04babb4ef123ee7b25e52deec48ad7ec
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
package com.java110.common.api;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.common.bmo.attrValue.IDeleteAttrValueBMO;
import com.java110.common.bmo.attrValue.IGetAttrValueBMO;
import com.java110.common.bmo.attrValue.ISaveAttrValueBMO;
import com.java110.common.bmo.attrValue.IUpdateAttrValueBMO;
import com.java110.common.bmo.machine.IMachineOpenDoorBMO;
import com.java110.common.bmo.machineTranslateError.IGetMachineTranslateErrorBMO;
import com.java110.dto.machineTranslateError.MachineTranslateErrorDto;
import com.java110.po.attrValue.AttrValuePo;
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.*;
 
 
@RestController
@RequestMapping(value = "/machine")
public class MachineApi {
 
    @Autowired
    private IMachineOpenDoorBMO machineOpenDoorBMOImpl;
 
    @Autowired
    private IGetMachineTranslateErrorBMO getMachineTranslateErrorBMOImpl;
 
    /**
     * 微信保存消息模板
     *
     * @param reqJson
     * @return
     * @serviceCode /machine/openDoor
     * @path /app/machine/openDoor
     */
    @RequestMapping(value = "/openDoor", method = RequestMethod.POST)
    public ResponseEntity<String> openDoor(@RequestBody JSONObject reqJson) {
 
        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息");
        Assert.hasKeyAndValue(reqJson, "machineCode", "请求报文中未包含设备信息");
        Assert.hasKeyAndValue(reqJson, "userType", "请求报文中未包含用户类型");
        Assert.hasKeyAndValue(reqJson, "userId", "请求报文中未包含用户信息");
 
        return machineOpenDoorBMOImpl.openDoor(reqJson);
    }
 
 
    /**
     * 微信删除消息模板
     * @serviceCode /machine/queryMachineTranslateError
     * @path /app/machine/queryMachineTranslateError
     * @param communityId 小区ID
     * @return
     */
    @RequestMapping(value = "/queryMachineTranslateError", method = RequestMethod.GET)
    public ResponseEntity<String> queryMachineTranslateError(@RequestParam(value = "communityId") String communityId,
                                                             @RequestParam(value = "page") int page,
                                                             @RequestParam(value = "row") int row) {
        MachineTranslateErrorDto machineTranslateErrorDto = new MachineTranslateErrorDto();
        machineTranslateErrorDto.setPage(page);
        machineTranslateErrorDto.setRow(row);
        machineTranslateErrorDto.setCommunityId(communityId);
        return getMachineTranslateErrorBMOImpl.get(machineTranslateErrorDto);
    }
 
}