java110
2021-01-19 597cae7743fde0ca86efb4659a2ded937fc308ae
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
117
118
119
120
121
122
123
124
125
126
127
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.job.adapt.hcIot;
 
import com.java110.utils.cache.MappingCache;
import com.java110.utils.util.StringUtil;
 
/**
 * HC 物联网常量类
 * 接口协议地址: https://gitee.com/java110/MicroCommunityThings/blob/master/back/docs/api.md
 *
 * @desc add by 吴学文 9:49
 */
public class IotConstant {
 
    public static final String IOT_DOMAIN = "IOT"; // 物联网域
    public static final String IOT_URL = "IOT_URL"; // 物联网域
    public static final String IOT_APP_ID = "APP_ID"; // 物联网域
    public static final String IOT_APP_SECRET = "APP_SECRET"; // 物联网域
 
    private static final String DEFAULT_IOT_URL = "https://things.homecommunity.cn";
 
    private static final String DEFAULT_APP_ID = "e86a6a373c354927bea5fd21a0bec617";
    private static final String DEFAULT_APP_SECRET = "ead9a2f67f96e2b8ed2fe38cc9709463";
 
    public static final String GET_TOKEN_URL = "/extApi/auth/getAccessToken?appId=APP_ID&appSecret=APP_SECRET";
 
    //添加小区
    public static final String ADD_COMMUNITY_URL = "/extApi/community/addCommunity";
    //修改小区
    public static final String UPDATE_COMMUNITY_URL = "/extApi/community/updateCommunity";
    //删除小区
    public static final String DELETE_COMMUNITY_URL = "/extApi/community/deleteCommunity";
 
    //添加设备
    public static final String ADD_MACHINE_URL = "/extApi/machine/addMachine";
    //修改设备
    public static final String UPDATE_MACHINE_URL = "/extApi/machine/updateMachine";
    //删除设备
    public static final String DELETE_MACHINE_URL = "/extApi/machine/deleteMachine";
 
    //添加停车场
    public static final String ADD_PARKING_AREA_URL = "/extApi/parkingArea/addParkingArea";
    //修改停车场
    public static final String UPDATE_PARKING_AREA_URL = "/extApi/parkingArea/updateParkingArea";
    //删除停车场
    public static final String DELETE_PARKING_AREA_URL = "/extApi/parkingArea/deleteParkingArea";
 
    //添加车辆
    public static final String ADD_OWNER_CAR_URL = "/extApi/car/addCar";
    //修改车辆
    public static final String UPDATE_OWNER_CAR_URL = "/extApi/car/updateCar";
    //删除车辆
    public static final String DELETE_OWNER_CAR_URL = "/extApi/car/deleteCar";
 
    //添加车辆
    public static final String ADD_CAR_BLACK_WHITE_URL = "/extApi/car/addBlackWhite";
 
    //删除车辆
    public static final String DELETE_CAR_BLACK_WHITE_URL = "/extApi/car/deleteBlackWhite";
 
    //开门接口
    public static final String OPEN_DOOR = "/extApi/machine/openDoor";
    //重启接口
    public static final String RESTART_MACHINE = "/extApi/machine/restartMachine";
 
    //添加车辆
    public static final String ADD_TEAM_CAR_FEE_CONFIG = "/extApi/fee/addTempCarFee";
    //修改车辆
    public static final String UPDATE_TEAM_CAR_FEE_CONFIG = "/extApi/fee/updateTempCarFee";
    //删除车辆
    public static final String DELETE_TEAM_CAR_FEE_CONFIG = "/extApi/fee/deleteTempCarFee";
 
    public static final String HC_TOKEN = "HC_ACCESS_TOKEN";
 
    //单位为秒
    public static final int DEFAULT_LOG_TIME = 5 * 60;
 
    //添加业主
    public static final String ADD_OWNER = "/extApi/user/addUser";
    public static final String EDIT_OWNER = "/extApi/user/updateUser";
    public static final String DELETE_OWNER = "/extApi/user/deleteUser";
 
 
    public static String getUrl(String param) {
        String url = MappingCache.getValue(IOT_DOMAIN, IotConstant.IOT_URL);
 
        if (StringUtil.isEmpty(url)) {
            return DEFAULT_IOT_URL + param;
        }
 
        return url + param;
    }
 
    public static String getAppId() {
        String appId = MappingCache.getValue(IOT_DOMAIN, IotConstant.IOT_APP_ID);
 
        if (StringUtil.isEmpty(appId)) {
            return DEFAULT_APP_ID;
        }
 
        return appId;
    }
 
    public static String getAppSecret() {
        String appSecret = MappingCache.getValue(IOT_DOMAIN, IotConstant.IOT_APP_SECRET);
 
        if (StringUtil.isEmpty(appSecret)) {
            return DEFAULT_APP_SECRET;
        }
 
        return appSecret;
    }
}