java110
2020-11-20 3ab8d7f1247da110b65bbaeb1906787a7b762ca6
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
package com.java110.user.api;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.po.owner.OwnerPo;
import com.java110.user.bmo.owner.IChangeOwnerPhone;
import com.java110.user.bmo.owner.IComprehensiveQuery;
import com.java110.user.bmo.owner.IQueryTenants;
import com.java110.user.bmo.owner.IVisitorRecord;
import com.java110.utils.util.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
 
@RestController
@RequestMapping(value = "/ownerApi")
public class OwnerApi {
 
    @Autowired
    private IQueryTenants queryTenantsImpl;
 
    @Autowired
    private IVisitorRecord visitorRecordImpl;
 
    @Autowired
    private IChangeOwnerPhone changeOwnerPhoneImpl;
 
 
    @Autowired
    private IComprehensiveQuery comprehensiveQueryImpl;
 
    @RequestMapping(value = "/tenants")
    public ResponseEntity<String> tenants(@RequestBody JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "code", "小区编码不能为空");
        return queryTenantsImpl.query(reqJson);
    }
 
    @RequestMapping(value = "/visitorRecord")
    public ResponseEntity<String> visitorRecord(@RequestBody JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "code", "小区编码不能为空");
        return visitorRecordImpl.query(reqJson);
    }
 
    /**
     * 变更 业主手机号
     *
     * @param reqJson
     * @return
     * @service /ownerApi/changeOwnerPhone
     * @path /app/ownerApi/changeOwnerPhoto
     */
    @RequestMapping(value = "/changeOwnerPhone", method = RequestMethod.POST)
    public ResponseEntity<String> changeOwnerPhone(@RequestBody JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "link", "请求报文中未包含手机号");
        Assert.hasKeyAndValue(reqJson, "userId", "请求报文中未包含用户ID");
        Assert.hasKeyAndValue(reqJson, "memberId", "请求报文中未包含业主信息");
        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息");
        OwnerPo ownerPo = new OwnerPo();
        ownerPo.setLink(reqJson.getString("link"));
        ownerPo.setMemberId(reqJson.getString("memberId"));
        ownerPo.setCommunityId(reqJson.getString("communityId"));
        ownerPo.setUserId(reqJson.getString("userId"));
 
        return changeOwnerPhoneImpl.change(ownerPo);
    }
 
    /**
     * 综合查询
     *
     * @param communityId 小区ID
     * @return
     * @service /ownerApi/comprehensiveQuery
     * @path /app/ownerApi/comprehensiveQuery
     */
    @RequestMapping(value = "/comprehensiveQuery", method = RequestMethod.GET)
    public ResponseEntity<String> comprehensiveQuery(@RequestParam(value = "communityId") String communityId,
                                                     @RequestParam(value = "searchValue") String searchValue,
                                                     @RequestParam(value = "searchType") String searchType) {
        return comprehensiveQueryImpl.query(communityId, searchValue, searchType);
    }
}