魏熙美 6 年之前
父節點
當前提交
492fbcfaa3

+ 268
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/fushi/Base64.java 查看文件

@@ -0,0 +1,268 @@
1
+package com.community.huiju.common.fushi;
2
+
3
+public final class Base64 {
4
+
5
+	private static final int BASELENGTH = 128;
6
+	private static final int LOOKUPLENGTH = 64;
7
+	private static final int TWENTYFOURBITGROUP = 24;
8
+	private static final int EIGHTBIT = 8;
9
+	private static final int SIXTEENBIT = 16;
10
+	private static final int FOURBYTE = 4;
11
+	private static final int SIGN = -128;
12
+	private static char PAD = '=';
13
+	private static byte[] base64Alphabet = new byte[BASELENGTH];
14
+	private static char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH];
15
+
16
+	static {
17
+		for (int i = 0; i < BASELENGTH; ++i) {
18
+			base64Alphabet[i] = -1;
19
+		}
20
+		for (int i = 'Z'; i >= 'A'; i--) {
21
+			base64Alphabet[i] = (byte) (i - 'A');
22
+		}
23
+		for (int i = 'z'; i >= 'a'; i--) {
24
+			base64Alphabet[i] = (byte) (i - 'a' + 26);
25
+		}
26
+
27
+		for (int i = '9'; i >= '0'; i--) {
28
+			base64Alphabet[i] = (byte) (i - '0' + 52);
29
+		}
30
+
31
+		base64Alphabet['+'] = 62;
32
+		base64Alphabet['/'] = 63;
33
+
34
+		for (int i = 0; i <= 25; i++) {
35
+			lookUpBase64Alphabet[i] = (char) ('A' + i);
36
+		}
37
+
38
+		for (int i = 26, j = 0; i <= 51; i++, j++) {
39
+			lookUpBase64Alphabet[i] = (char) ('a' + j);
40
+		}
41
+
42
+		for (int i = 52, j = 0; i <= 61; i++, j++) {
43
+			lookUpBase64Alphabet[i] = (char) ('0' + j);
44
+		}
45
+		lookUpBase64Alphabet[62] = (char) '+';
46
+		lookUpBase64Alphabet[63] = (char) '/';
47
+
48
+	}
49
+
50
+	private static boolean isWhiteSpace(char octect) {
51
+		return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9);
52
+	}
53
+
54
+	private static boolean isPad(char octect) {
55
+		return (octect == PAD);
56
+	}
57
+
58
+	private static boolean isData(char octect) {
59
+		return (octect < BASELENGTH && base64Alphabet[octect] != -1);
60
+	}
61
+
62
+	/**
63
+	 * Encodes hex octects into Base64
64
+	 * 
65
+	 * @param binaryData
66
+	 *            Array containing binaryData
67
+	 * @return Encoded Base64 array
68
+	 */
69
+	public static String encode(byte[] binaryData) {
70
+
71
+		if (binaryData == null) {
72
+			return null;
73
+		}
74
+
75
+		int lengthDataBits = binaryData.length * EIGHTBIT;
76
+		if (lengthDataBits == 0) {
77
+			return "";
78
+		}
79
+
80
+		int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
81
+		int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
82
+		int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1
83
+				: numberTriplets;
84
+		char encodedData[] = null;
85
+
86
+		encodedData = new char[numberQuartet * 4];
87
+
88
+		byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
89
+
90
+		int encodedIndex = 0;
91
+		int dataIndex = 0;
92
+
93
+		for (int i = 0; i < numberTriplets; i++) {
94
+			b1 = binaryData[dataIndex++];
95
+			b2 = binaryData[dataIndex++];
96
+			b3 = binaryData[dataIndex++];
97
+
98
+			l = (byte) (b2 & 0x0f);
99
+			k = (byte) (b1 & 0x03);
100
+
101
+			byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
102
+					: (byte) ((b1) >> 2 ^ 0xc0);
103
+			byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4)
104
+					: (byte) ((b2) >> 4 ^ 0xf0);
105
+			byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6)
106
+					: (byte) ((b3) >> 6 ^ 0xfc);
107
+
108
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
109
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
110
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3];
111
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f];
112
+		}
113
+
114
+		// form integral number of 6-bit groups
115
+		if (fewerThan24bits == EIGHTBIT) {
116
+			b1 = binaryData[dataIndex];
117
+			k = (byte) (b1 & 0x03);
118
+			
119
+			byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
120
+					: (byte) ((b1) >> 2 ^ 0xc0);
121
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
122
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4];
123
+			encodedData[encodedIndex++] = PAD;
124
+			encodedData[encodedIndex++] = PAD;
125
+		} else if (fewerThan24bits == SIXTEENBIT) {
126
+			b1 = binaryData[dataIndex];
127
+			b2 = binaryData[dataIndex + 1];
128
+			l = (byte) (b2 & 0x0f);
129
+			k = (byte) (b1 & 0x03);
130
+
131
+			byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
132
+					: (byte) ((b1) >> 2 ^ 0xc0);
133
+			byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4)
134
+					: (byte) ((b2) >> 4 ^ 0xf0);
135
+
136
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val1];
137
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)];
138
+			encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2];
139
+			encodedData[encodedIndex++] = PAD;
140
+		}
141
+
142
+		return new String(encodedData);
143
+	}
144
+
145
+	/**
146
+	 * Decodes Base64 data into octects
147
+	 * 
148
+	 * @param encoded
149
+	 *            string containing Base64 data
150
+	 * @return Array containind decoded data.
151
+	 */
152
+	public static byte[] decode(String encoded) {
153
+
154
+		if (encoded == null) {
155
+			return null;
156
+		}
157
+
158
+		char[] base64Data = encoded.toCharArray();
159
+		// remove white spaces
160
+		int len = removeWhiteSpace(base64Data);
161
+
162
+		if (len % FOURBYTE != 0) {
163
+			return null;// should be divisible by four
164
+		}
165
+
166
+		int numberQuadruple = (len / FOURBYTE);
167
+
168
+		if (numberQuadruple == 0) {
169
+			return new byte[0];
170
+		}
171
+
172
+		byte decodedData[] = null;
173
+		byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
174
+		char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
175
+
176
+		int i = 0;
177
+		int encodedIndex = 0;
178
+		int dataIndex = 0;
179
+		decodedData = new byte[(numberQuadruple) * 3];
180
+
181
+		for (; i < numberQuadruple - 1; i++) {
182
+
183
+			if (!isData((d1 = base64Data[dataIndex++]))
184
+					|| !isData((d2 = base64Data[dataIndex++]))
185
+					|| !isData((d3 = base64Data[dataIndex++]))
186
+					|| !isData((d4 = base64Data[dataIndex++]))) {
187
+				return null;
188
+			}// if found "no data" just return null
189
+
190
+			b1 = base64Alphabet[d1];
191
+			b2 = base64Alphabet[d2];
192
+			b3 = base64Alphabet[d3];
193
+			b4 = base64Alphabet[d4];
194
+
195
+			decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
196
+			decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
197
+			decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
198
+		}
199
+
200
+		if (!isData((d1 = base64Data[dataIndex++]))
201
+				|| !isData((d2 = base64Data[dataIndex++]))) {
202
+			return null;// if found "no data" just return null
203
+		}
204
+
205
+		b1 = base64Alphabet[d1];
206
+		b2 = base64Alphabet[d2];
207
+
208
+		d3 = base64Data[dataIndex++];
209
+		d4 = base64Data[dataIndex++];
210
+		if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
211
+			if (isPad(d3) && isPad(d4)) {
212
+				if ((b2 & 0xf) != 0)// last 4 bits should be zero
213
+				{
214
+					return null;
215
+				}
216
+				byte[] tmp = new byte[i * 3 + 1];
217
+				System.arraycopy(decodedData, 0, tmp, 0, i * 3);
218
+				tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4);
219
+				return tmp;
220
+			} else if (!isPad(d3) && isPad(d4)) {
221
+				b3 = base64Alphabet[d3];
222
+				if ((b3 & 0x3) != 0)// last 2 bits should be zero
223
+				{
224
+					return null;
225
+				}
226
+				byte[] tmp = new byte[i * 3 + 2];
227
+				System.arraycopy(decodedData, 0, tmp, 0, i * 3);
228
+				tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
229
+				tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
230
+				return tmp;
231
+			} else {
232
+				return null;
233
+			}
234
+		} else { // No PAD e.g 3cQl
235
+			b3 = base64Alphabet[d3];
236
+			b4 = base64Alphabet[d4];
237
+			decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
238
+			decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf));
239
+			decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
240
+
241
+		}
242
+
243
+		return decodedData;
244
+	}
245
+
246
+	/**
247
+	 * remove WhiteSpace from MIME containing encoded Base64 data.
248
+	 * 
249
+	 * @param data
250
+	 *            the byte array of base64 data (with WS)
251
+	 * @return the new length
252
+	 */
253
+	private static int removeWhiteSpace(char[] data) {
254
+		if (data == null) {
255
+			return 0;
256
+		}
257
+
258
+		// count characters that's not whitespace
259
+		int newSize = 0;
260
+		int len = data.length;
261
+		for (int i = 0; i < len; i++) {
262
+			if (!isWhiteSpace(data[i])) {
263
+				data[newSize++] = data[i];
264
+			}
265
+		}
266
+		return newSize;
267
+	}
268
+}

+ 166
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/fushi/FSApi.java 查看文件

@@ -0,0 +1,166 @@
1
+package com.community.huiju.common.fushi;
2
+
3
+import com.alibaba.fastjson.JSONObject;
4
+
5
+import java.io.BufferedReader;
6
+import java.io.IOException;
7
+import java.io.InputStreamReader;
8
+import java.io.OutputStream;
9
+import java.net.HttpURLConnection;
10
+import java.net.URL;
11
+import java.security.KeyFactory;
12
+import java.security.PrivateKey;
13
+import java.security.spec.PKCS8EncodedKeySpec;
14
+import java.util.Map;
15
+import java.util.SortedMap;
16
+import java.util.TreeMap;
17
+
18
+public class FSApi {
19
+
20
+    //	private static String url = "http://mops-test.fujica.com.cn:8021/Api/Park/GetParkInfoByCarNo";
21
+    private static String url = "http://api.mops.fujica.com.cn/v2/Api/Park/GetParkInfoByCarNo";
22
+    private static String appid = "fujica_89aa0f62d7ec77fc";
23
+    private static String appSecret = "cef36935e0954f40afc519a43a0c857c";
24
+    private static String privateKey = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALATu5WNNx+XcrAS\n" +
25
+            "NJieGRsY7VryQjcs+pABXGh4BOCqAW3FgAAc21aIG0uxvYHdQUw1I7J80RiQJ506\n" +
26
+            "aIktGTmZKJTjez7JNF7GO4ieGmLMI3ds8iXyJrfUMp/1U3Cq6vja8vuRIKYVQCxZ\n" +
27
+            "e8un98Nr03F7oMlKpBydJQKVdlAHAgMBAAECgYBPcqfqhAyCWbCrF5vZ3URQwL+g\n" +
28
+            "kL0l7kqknaiXjsgMo0j/weTOqDaj5cgDMJDkvvPOsg+IYt9qKOlm/Urb0piVb9v9\n" +
29
+            "iAnp6gIppcyHrPUesgYRSbqR/HhdGtnzn/4f45YpkXA6URMfc04xBrIUCw5Dmnqo\n" +
30
+            "nJZJkjd6jjXiL65rYQJBAN8eg99yFH45D2cdlPBTN0LVWXgqy3N22byYh0j6kgo2\n" +
31
+            "5WOPMcuIZPM/XdSoTfhYeHixvEwrmCAkCmSkf524prECQQDKBnzZRj3eCij1z2SZ\n" +
32
+            "JCRZhRQUhFmK0AYYTXw9R0DfEaZNrEAe8PEypS94lYROvNV3TnSnK2FHKeH8YhHX\n" +
33
+            "EoA3AkBRHzMrRrsUuYJUJ3lDd74b2p5RBp46OPgpjfuCGTiH5jW44RNlwQ2TM3LW\n" +
34
+            "IutWZDRJDbY8q40AApqUxQpxOfXBAkA8bB5RGZoNW7qOcj3jM5UPlSbBUCg7xSXd\n" +
35
+            "hOdAqJv1W6ECoB75YhSxkggVp5pPtlid+0AWc3n/v74QLwCo86aXAkEAlxY3hoxQ\n" +
36
+            "jJiCjD2PbL0GLkMKNBqJgLcDWqeoHcal+iY2Fpr3U/iCJZNoBuovC2Qvc5J1y61P\n" +
37
+            "ojrvFNyFMEkWTQ==";
38
+    private static String sign = "";
39
+    private static String time;
40
+
41
+    public static void main(String[] args) {
42
+        time = getTimestamp();
43
+        String jsonString = "{'ParkingCode':'19000100250504','CarNo':'苏A8M6B2'}";
44
+
45
+        TreeMap<String, String> map = new TreeMap();
46
+        map.put("param", jsonString);
47
+        map.put("secret", appSecret);
48
+        map.put("timestamp", time);
49
+        sign = signWithoutMD5(map);
50
+        sign = sign(sign, privateKey);
51
+
52
+        doJsonPost(url, jsonString);
53
+    }
54
+
55
+    public static String doJsonPost(String urlPath, String Json) {
56
+        String result = "";
57
+        BufferedReader reader = null;
58
+        try {
59
+            URL url = new URL(urlPath);
60
+            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
61
+            conn.setRequestMethod("POST");
62
+            conn.setDoOutput(true);
63
+            conn.setDoInput(true);
64
+            conn.setUseCaches(false);
65
+            conn.setRequestProperty("Connection", "Keep-Alive");
66
+            conn.setRequestProperty("Charset", "UTF-8");
67
+            conn.setRequestProperty("appid", appid);
68
+            conn.setRequestProperty("appSecret", appSecret);
69
+            conn.setRequestProperty("sign", sign);
70
+            conn.setRequestProperty("timestamp", time);
71
+            // 设置文件类型:
72
+            conn.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
73
+            // 设置接收类型否则返回415错误
74
+            conn.setRequestProperty("accept", "*/*");// 此处为暴力方法设置接受所有类型,以此来防范返回415;
75
+            conn.setRequestProperty("accept", "application/json");
76
+            // 往服务器里面发送数据
77
+            if (Json != null && !("").equals(Json)) {
78
+                byte[] writebytes = Json.getBytes();
79
+                // 设置文件长度
80
+                conn.setRequestProperty("Content-Length", String.valueOf(writebytes.length));
81
+                OutputStream outwritestream = (OutputStream) conn.getOutputStream();
82
+                outwritestream.write(Json.getBytes());
83
+                outwritestream.flush();
84
+                outwritestream.close();
85
+
86
+            }
87
+            if (conn.getResponseCode() == 200) {
88
+                reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
89
+                result = reader.readLine();
90
+                System.out.println(result);
91
+            }
92
+        } catch (Exception e) {
93
+            e.printStackTrace();
94
+        } finally {
95
+            if (reader != null) {
96
+                try {
97
+                    reader.close();
98
+                } catch (IOException e) {
99
+                    e.printStackTrace();
100
+                }
101
+            }
102
+        }
103
+        return result;
104
+    }
105
+
106
+    public static String getTimestamp() {
107
+        String time = "";
108
+        long timestamp = System.currentTimeMillis();
109
+        time = String.valueOf(timestamp);
110
+        time = time.substring(0, 10);
111
+        return time;
112
+    }
113
+
114
+    public static String signWithoutMD5(SortedMap<String, String> params) {
115
+        String restul = "";
116
+        if (params == null) {
117
+            return restul;
118
+        }
119
+
120
+        StringBuilder sb = new StringBuilder();
121
+        for (Map.Entry<String, String> me : params.entrySet()) {
122
+
123
+            sb.append(me.getKey());
124
+            sb.append('=');
125
+            sb.append(me.getValue());
126
+            sb.append('&');
127
+
128
+        }
129
+        int lastIndexOf = sb.lastIndexOf("&");
130
+        if (lastIndexOf != -1) {
131
+            sb.deleteCharAt(lastIndexOf);
132
+        }
133
+        restul = new String(sb);
134
+
135
+        return restul;
136
+    }
137
+
138
+    private static final String ALGORITHM = "RSA";
139
+    private static final String SIGN_ALGORITHMS = "SHA1WithRSA";
140
+
141
+    private static final String DEFAULT_CHARSET = "UTF-8";
142
+
143
+    public static String sign(String content, String privateKey) {
144
+        try {
145
+            PKCS8EncodedKeySpec priPKCS8 = new PKCS8EncodedKeySpec(Base64.decode(privateKey));
146
+            KeyFactory keyf = KeyFactory.getInstance(ALGORITHM);
147
+
148
+            PrivateKey priKey = keyf.generatePrivate(priPKCS8);
149
+
150
+            java.security.Signature signature = java.security.Signature.getInstance(SIGN_ALGORITHMS);
151
+
152
+            signature.initSign(priKey);
153
+            signature.update(content.getBytes(DEFAULT_CHARSET));
154
+
155
+            byte[] signed = signature.sign();
156
+
157
+            return Base64.encode(signed);
158
+        } catch (Exception e) {
159
+            e.printStackTrace();
160
+        }
161
+
162
+        return null;
163
+    }
164
+
165
+
166
+}

+ 1
- 1
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKConstant.java 查看文件

@@ -53,7 +53,7 @@ public class HKConstant {
53 53
     public static final String ITF_ADDRESS_GET_CAMERAS = "/openapi/service/vss/res/getCameras";
54 54
 
55 55
     /**
56
-     * 查询监控点地址
56
+     * 操作用户的UUID
57 57
      */
58 58
     public static final String OP_USER_UUID = "5b2eb534696b11e89c2e438f92627767";
59 59
 

+ 23
- 2
CODE/smart-community/app-api/src/main/java/com/community/huiju/common/hk/HKOpenApi.java 查看文件

@@ -98,7 +98,7 @@ public class HKOpenApi {
98 98
     public static String addUser(Map<String,Object> map){
99 99
         Map<String,Object> parMap = Maps.newHashMap();
100 100
         String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_ADD_USER;
101
-        //设置APPKEY
101
+        //设置APPKEY获取中心信息
102 102
         parMap.put("appkey", HKConstant.APPKEY);
103 103
         //设置时间参数
104 104
         parMap.put("time", System.currentTimeMillis());
@@ -953,7 +953,28 @@ public class HKOpenApi {
953 953
 
954 954
     public static void main(String[] args) {
955 955
         // getDefaultUserUuid();
956
-        downloadFaceAndFingerInfos("2227");
956
+        Map<String,Object> parMap = Maps.newHashMap();
957
+        String url = "http://pingtai.vipgz1.idcfengye.com" + HKConstant.ITF_MONITORY_POINT;
958
+        //设置APPKEY
959
+        parMap.put("appkey", "d30396a0");
960
+        //设置时间参数
961
+        parMap.put("time", System.currentTimeMillis());
962
+        parMap.put("pageNo","1");
963
+        parMap.put("pageSize","100");
964
+        parMap.put("opUserUuid","5b2eb534696b11e89c2e438f92627767");
965
+        parMap.put("unitUuids","1048576");
966
+        String params =  JSON.toJSONString(parMap);
967
+        log.info("获取 监控列表 请求参数:{}", params);
968
+        String data = null;
969
+        try {
970
+            data = HttpClientSSLUtils.doPost(url + "?token=" + Digests.buildToken(url + "?" + params, params, "6a939cf0b2914004a2755e70c6c96e02"), params);
971
+            log.info("获取 监控列表 请求返回结果:{}",data);
972
+        } catch (Exception e) {
973
+            e.printStackTrace();
974
+            log.error("获取监控列表失败!",e);
975
+            throw new RuntimeException("获取监控列表失败!");
976
+        }
977
+
957 978
     }
958 979
 
959 980
 }

+ 3
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpEquipmentMapper.java 查看文件

@@ -1,10 +1,7 @@
1 1
 package com.community.huiju.dao;
2 2
 
3 3
 import com.community.huiju.model.TpEquipment;
4
-import org.apache.ibatis.annotations.Mapper;
5
-import org.apache.ibatis.annotations.Param;
6
-import org.apache.ibatis.annotations.ResultType;
7
-import org.apache.ibatis.annotations.Select;
4
+import org.apache.ibatis.annotations.*;
8 5
 
9 6
 import java.util.List;
10 7
 
@@ -27,9 +24,9 @@ public interface TpEquipmentMapper {
27 24
      * @param communityId
28 25
      * @return
29 26
      */
30
-    @ResultType(TpEquipment.class)
27
+    @ResultMap("BaseResultMap")
31 28
     @Select("select " +
32
-            "tm.id as id, " +
29
+            "tm.*, " +
33 30
             "(select configuration_value FROM tp_configuration WHERE id = tm.url_id) as monitoringUrl, " +
34 31
             "(select configuration_value FROM tp_configuration WHERE id = tm.security_guard_tel_id) as securityGuardTel, " +
35 32
             "(select configuration_value FROM tp_configuration WHERE id = tm.security_room_tel_id) as securityRoomTel, " +

+ 30
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/dao/TpEquipmentTreeMapper.java 查看文件

@@ -0,0 +1,30 @@
1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpEquipmentTree;
4
+import org.apache.ibatis.annotations.Mapper;
5
+import org.apache.ibatis.annotations.ResultMap;
6
+import org.apache.ibatis.annotations.Select;
7
+
8
+@Mapper
9
+public interface TpEquipmentTreeMapper {
10
+    int deleteByPrimaryKey(Integer id);
11
+
12
+    int insert(TpEquipmentTree record);
13
+
14
+    int insertSelective(TpEquipmentTree record);
15
+
16
+    TpEquipmentTree selectByPrimaryKey(Integer id);
17
+
18
+    int updateByPrimaryKeySelective(TpEquipmentTree record);
19
+
20
+    int updateByPrimaryKey(TpEquipmentTree record);
21
+
22
+    /**
23
+     * 根据小区查询
24
+     * @param communityId
25
+     * @return
26
+     */
27
+    @ResultMap("BaseResultMap")
28
+    @Select("select * from tp_equipment_tree where community_id = #{communityId}")
29
+    TpEquipmentTree selectByCommunityId(Integer communityId);
30
+}

+ 72
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpEquipment.java 查看文件

@@ -1,5 +1,7 @@
1 1
 package com.community.huiju.model;
2 2
 
3
+import com.alibaba.fastjson.annotation.JSONField;
4
+
3 5
 import java.util.Date;
4 6
 
5 7
 public class TpEquipment {
@@ -28,6 +30,36 @@ public class TpEquipment {
28 30
     private String equipmentType;
29 31
 
30 32
     private Integer equipmentTreeId;
33
+
34
+    /**
35
+     * 这个值不返回给客户端
36
+     */
37
+    @JSONField(serialize = false)
38
+    private String appkey;
39
+
40
+    /**
41
+     * 这个值不返回给客户端
42
+     */
43
+    @JSONField(serialize = false)
44
+    private String secret;
45
+
46
+    /**
47
+     * 这个值不返回给客户端
48
+     */
49
+    @JSONField(serialize = false)
50
+    private String opUserUuid;
51
+
52
+    /**
53
+     * 这个值不返回给客户端
54
+     */
55
+    @JSONField(serialize = false)
56
+    private String httpServer;
57
+
58
+    /**
59
+     * 这个值不返回给客户端
60
+     */
61
+    @JSONField(serialize = false)
62
+    private String unitUuids;
31 63
     // ====================================
32 64
 
33 65
     /**
@@ -185,4 +217,44 @@ public class TpEquipment {
185 217
     public void setMonitoringAddress(String monitoringAddress) {
186 218
         this.monitoringAddress = monitoringAddress;
187 219
     }
220
+
221
+    public String getAppkey() {
222
+        return appkey;
223
+    }
224
+
225
+    public void setAppkey(String appkey) {
226
+        this.appkey = appkey;
227
+    }
228
+
229
+    public String getSecret() {
230
+        return secret;
231
+    }
232
+
233
+    public void setSecret(String secret) {
234
+        this.secret = secret;
235
+    }
236
+
237
+    public String getOpUserUuid() {
238
+        return opUserUuid;
239
+    }
240
+
241
+    public void setOpUserUuid(String opUserUuid) {
242
+        this.opUserUuid = opUserUuid;
243
+    }
244
+
245
+    public String getHttpServer() {
246
+        return httpServer;
247
+    }
248
+
249
+    public void setHttpServer(String httpServer) {
250
+        this.httpServer = httpServer;
251
+    }
252
+
253
+    public String getUnitUuids() {
254
+        return unitUuids;
255
+    }
256
+
257
+    public void setUnitUuids(String unitUuids) {
258
+        this.unitUuids = unitUuids;
259
+    }
188 260
 }

+ 145
- 0
CODE/smart-community/app-api/src/main/java/com/community/huiju/model/TpEquipmentTree.java 查看文件

@@ -0,0 +1,145 @@
1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpEquipmentTree {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String equipmentName;
11
+
12
+    private Integer pid;
13
+
14
+    private Integer sort;
15
+
16
+    private Date createTime;
17
+
18
+    private Integer createUser;
19
+
20
+    private Date updateTime;
21
+
22
+    private Integer updateUser;
23
+
24
+    private String appkey;
25
+
26
+    private String secret;
27
+
28
+    private String opUserUuid;
29
+
30
+    private String httpServer;
31
+
32
+    private String unitUuids;
33
+
34
+    public Integer getId() {
35
+        return id;
36
+    }
37
+
38
+    public void setId(Integer id) {
39
+        this.id = id;
40
+    }
41
+
42
+    public Integer getCommunityId() {
43
+        return communityId;
44
+    }
45
+
46
+    public void setCommunityId(Integer communityId) {
47
+        this.communityId = communityId;
48
+    }
49
+
50
+    public String getEquipmentName() {
51
+        return equipmentName;
52
+    }
53
+
54
+    public void setEquipmentName(String equipmentName) {
55
+        this.equipmentName = equipmentName == null ? null : equipmentName.trim();
56
+    }
57
+
58
+    public Integer getPid() {
59
+        return pid;
60
+    }
61
+
62
+    public void setPid(Integer pid) {
63
+        this.pid = pid;
64
+    }
65
+
66
+    public Integer getSort() {
67
+        return sort;
68
+    }
69
+
70
+    public void setSort(Integer sort) {
71
+        this.sort = sort;
72
+    }
73
+
74
+    public Date getCreateTime() {
75
+        return createTime;
76
+    }
77
+
78
+    public void setCreateTime(Date createTime) {
79
+        this.createTime = createTime;
80
+    }
81
+
82
+    public Integer getCreateUser() {
83
+        return createUser;
84
+    }
85
+
86
+    public void setCreateUser(Integer createUser) {
87
+        this.createUser = createUser;
88
+    }
89
+
90
+    public Date getUpdateTime() {
91
+        return updateTime;
92
+    }
93
+
94
+    public void setUpdateTime(Date updateTime) {
95
+        this.updateTime = updateTime;
96
+    }
97
+
98
+    public Integer getUpdateUser() {
99
+        return updateUser;
100
+    }
101
+
102
+    public void setUpdateUser(Integer updateUser) {
103
+        this.updateUser = updateUser;
104
+    }
105
+
106
+    public String getAppkey() {
107
+        return appkey;
108
+    }
109
+
110
+    public void setAppkey(String appkey) {
111
+        this.appkey = appkey == null ? null : appkey.trim();
112
+    }
113
+
114
+    public String getSecret() {
115
+        return secret;
116
+    }
117
+
118
+    public void setSecret(String secret) {
119
+        this.secret = secret == null ? null : secret.trim();
120
+    }
121
+
122
+    public String getOpUserUuid() {
123
+        return opUserUuid;
124
+    }
125
+
126
+    public void setOpUserUuid(String opUserUuid) {
127
+        this.opUserUuid = opUserUuid == null ? null : opUserUuid.trim();
128
+    }
129
+
130
+    public String getHttpServer() {
131
+        return httpServer;
132
+    }
133
+
134
+    public void setHttpServer(String httpServer) {
135
+        this.httpServer = httpServer == null ? null : httpServer.trim();
136
+    }
137
+
138
+    public String getUnitUuids() {
139
+        return unitUuids;
140
+    }
141
+
142
+    public void setUnitUuids(String unitUuids) {
143
+        this.unitUuids = unitUuids;
144
+    }
145
+}

+ 48
- 6
CODE/smart-community/app-api/src/main/java/com/community/huiju/service/impl/MonitoringServiceImpl.java 查看文件

@@ -1,15 +1,20 @@
1 1
 package com.community.huiju.service.impl;
2 2
 import com.alibaba.fastjson.JSON;
3 3
 import com.community.commom.hk.Digests;
4
+import com.community.commom.hk.HttpClientSSLUtils;
4 5
 import com.community.commom.mode.ResponseBean;
5 6
 import com.community.huiju.common.hk.HKConstant;
7
+import com.community.huiju.common.hk.HKOpenApi;
6 8
 import com.community.huiju.dao.TpEquipmentMapper;
9
+import com.community.huiju.dao.TpEquipmentTreeMapper;
7 10
 import com.community.huiju.model.TpEquipment;
11
+import com.community.huiju.model.TpEquipmentTree;
8 12
 import com.community.huiju.service.IMonitoringService;
9 13
 import com.github.pagehelper.Page;
10 14
 import com.github.pagehelper.PageHelper;
11 15
 import com.google.common.collect.Maps;
12 16
 import lombok.extern.slf4j.Slf4j;
17
+import org.apache.commons.lang3.StringUtils;
13 18
 import org.springframework.beans.factory.annotation.Autowired;
14 19
 import org.springframework.stereotype.Service;
15 20
 
@@ -27,6 +32,9 @@ public class MonitoringServiceImpl implements IMonitoringService {
27 32
     @Autowired
28 33
     private TpEquipmentMapper tpEquipmentMapper;
29 34
 
35
+    @Autowired
36
+    private TpEquipmentTreeMapper tpEquipmentTreeMapper;
37
+
30 38
     @Override
31 39
     public ResponseBean getByCommunityId(Integer communityId,Integer pageNo, Integer pageSize) {
32 40
 
@@ -68,23 +76,57 @@ public class MonitoringServiceImpl implements IMonitoringService {
68 76
     @Override
69 77
     public ResponseBean getMonitoringToken(Integer communityId, Integer pageNo, Integer pageSize) {
70 78
 
71
-        // TODO 数据是假数据, 后期在更改. 需要根据小区查询 组织中心编号
79
+        String appkey = "";
80
+        String op_user_uuid = "";
81
+        String secret = "";
82
+        String openapi_ip_port_http = "";
83
+        String unitUuids = "";
84
+
85
+        /**
86
+         * 先检测设备 的appkey,op_user_uuid, secret 是否有值
87
+         * 如果有值,则使用 设备里面的参数
88
+         */
89
+
90
+        Page<TpEquipment> page = PageHelper.startPage(pageNo, pageSize);
91
+        List<TpEquipment> tpEquipments = tpEquipmentMapper.selectByCommunityId(communityId);
92
+        if (!tpEquipments.isEmpty()) {
93
+            TpEquipment equipment = tpEquipments.get(0);
94
+            if (StringUtils.isNotBlank(equipment.getAppkey()) && StringUtils.isNotBlank(equipment.getOpUserUuid()) && StringUtils.isNotBlank(equipment.getSecret())) {
95
+                appkey = equipment.getAppkey();
96
+                op_user_uuid = equipment.getOpUserUuid();
97
+                secret = equipment.getSecret();
98
+                openapi_ip_port_http = equipment.getHttpServer();
99
+                unitUuids = equipment.getUnitUuids();
100
+            }
101
+        }
102
+
103
+        TpEquipmentTree tpEquipmentTree = tpEquipmentTreeMapper.selectByCommunityId(communityId);
104
+        // 如果设备里面没有值
105
+        if (StringUtils.isBlank(appkey) && StringUtils.isBlank(op_user_uuid) && StringUtils.isBlank(secret)) {
106
+            appkey = tpEquipmentTree.getAppkey();
107
+            op_user_uuid = tpEquipmentTree.getOpUserUuid();
108
+            secret = tpEquipmentTree.getSecret();
109
+            openapi_ip_port_http = tpEquipmentTree.getHttpServer();
110
+            unitUuids = tpEquipmentTree.getUnitUuids();
111
+        }
112
+
72 113
 
73 114
         ResponseBean response = new ResponseBean();
74 115
         Map<String,Object> parMap = Maps.newHashMap();
75
-        String url = HKConstant.OPENAPI_IP_PORT_HTTP + HKConstant.ITF_MONITORY_POINT;
116
+        String url = openapi_ip_port_http + HKConstant.ITF_MONITORY_POINT;
76 117
         //设置APPKEY
77
-        parMap.put("appkey", HKConstant.APPKEY);
118
+        parMap.put("appkey", appkey);
78 119
         //设置时间参数
79 120
         parMap.put("time", System.currentTimeMillis());
80 121
         parMap.put("pageNo",pageNo);
81 122
         parMap.put("pageSize",pageSize);
82 123
         // 这里可以设置其他操作用户 parMap.put("opUserUuid",map.get("opUserUuid") == null?HKConstant.OP_USER_UUID:map.get("opUserUuid"));
83
-        parMap.put("opUserUuid",HKConstant.OP_USER_UUID);
124
+        parMap.put("opUserUuid",op_user_uuid);
84 125
         // 组织中心编号
85
-        parMap.put("unitUuids","1048576");
126
+        // parMap.put("unitUuids","1048576");
127
+        parMap.put("unitUuids",unitUuids);
86 128
         String params =  JSON.toJSONString(parMap);
87
-        String token = Digests.buildToken(url + "?" + params, params, HKConstant.SECRET);
129
+        String token = Digests.buildToken(url + "?" + params, params, secret);
88 130
 
89 131
         Map<String, Object> map = Maps.newHashMap();
90 132
         map.put("token",token);

+ 68
- 4
CODE/smart-community/app-api/src/main/resources/mapper/TpEquipmentMapper.xml 查看文件

@@ -15,10 +15,20 @@
15 15
     <result column="uuid_id" property="uuidId" jdbcType="INTEGER" />
16 16
     <result column="equipment_type" property="equipmentType" jdbcType="VARCHAR" />
17 17
     <result column="equipment_tree_id" property="equipmentTreeId" jdbcType="INTEGER" />
18
+    <result column="appkey" property="appkey" jdbcType="VARCHAR" />
19
+    <result column="secret" property="secret" jdbcType="VARCHAR" />
20
+    <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
21
+    <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
22
+    <result column="unit_uuids" property="unitUuids" jdbcType="VARCHAR" />
23
+    <result column="monitoringUrl" property="monitoringUrl" />
24
+    <result column="securityGuardTel" property="securityGuardTel" />
25
+    <result column="securityRoomTel" property="securityRoomTel" />
26
+    <result column="monitoringAddress" property="monitoringAddress" />
18 27
   </resultMap>
19 28
   <sql id="Base_Column_List" >
20 29
     id, url_id, community_id, security_guard_tel_id, security_room_tel_id, address_id,
21
-    create_time, create_user, update_time, update_user, uuid_id, equipment_type, equipment_tree_id
30
+    create_time, create_user, update_time, update_user, uuid_id, equipment_type, equipment_tree_id,
31
+    appkey, secret, op_user_uuid, http_server, unit_uuids
22 32
   </sql>
23 33
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
24 34
     select
@@ -35,12 +45,16 @@
35 45
       security_guard_tel_id, security_room_tel_id,
36 46
       address_id, create_time, create_user,
37 47
       update_time, update_user, uuid_id,
38
-      equipment_type, equipment_tree_id)
48
+      equipment_type, equipment_tree_id, appkey,
49
+      secret, op_user_uuid, http_server,
50
+      unit_uuids)
39 51
     values (#{id,jdbcType=INTEGER}, #{urlId,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER},
40 52
       #{securityGuardTelId,jdbcType=INTEGER}, #{securityRoomTelId,jdbcType=INTEGER},
41 53
       #{addressId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{createUser,jdbcType=INTEGER},
42 54
       #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{uuidId,jdbcType=INTEGER},
43
-      #{equipmentType,jdbcType=VARCHAR}, #{equipmentTreeId,jdbcType=INTEGER})
55
+      #{equipmentType,jdbcType=VARCHAR}, #{equipmentTreeId,jdbcType=INTEGER}, #{appkey,jdbcType=VARCHAR},
56
+      #{secret,jdbcType=VARCHAR}, #{opUserUuid,jdbcType=VARCHAR}, #{httpServer,jdbcType=VARCHAR},
57
+      #{unitUuids,jdbcType=VARCHAR})
44 58
   </insert>
45 59
   <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipment" >
46 60
     insert into tp_equipment
@@ -84,6 +98,21 @@
84 98
       <if test="equipmentTreeId != null" >
85 99
         equipment_tree_id,
86 100
       </if>
101
+      <if test="appkey != null" >
102
+        appkey,
103
+      </if>
104
+      <if test="secret != null" >
105
+        secret,
106
+      </if>
107
+      <if test="opUserUuid != null" >
108
+        op_user_uuid,
109
+      </if>
110
+      <if test="httpServer != null" >
111
+        http_server,
112
+      </if>
113
+      <if test="unitUuids != null" >
114
+        unit_uuids,
115
+      </if>
87 116
     </trim>
88 117
     <trim prefix="values (" suffix=")" suffixOverrides="," >
89 118
       <if test="id != null" >
@@ -125,6 +154,21 @@
125 154
       <if test="equipmentTreeId != null" >
126 155
         #{equipmentTreeId,jdbcType=INTEGER},
127 156
       </if>
157
+      <if test="appkey != null" >
158
+        #{appkey,jdbcType=VARCHAR},
159
+      </if>
160
+      <if test="secret != null" >
161
+        #{secret,jdbcType=VARCHAR},
162
+      </if>
163
+      <if test="opUserUuid != null" >
164
+        #{opUserUuid,jdbcType=VARCHAR},
165
+      </if>
166
+      <if test="httpServer != null" >
167
+        #{httpServer,jdbcType=VARCHAR},
168
+      </if>
169
+      <if test="unitUuids != null" >
170
+        #{unitUuids,jdbcType=VARCHAR},
171
+      </if>
128 172
     </trim>
129 173
   </insert>
130 174
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipment" >
@@ -166,6 +210,21 @@
166 210
       <if test="equipmentTreeId != null" >
167 211
         equipment_tree_id = #{equipmentTreeId,jdbcType=INTEGER},
168 212
       </if>
213
+      <if test="appkey != null" >
214
+        appkey = #{appkey,jdbcType=VARCHAR},
215
+      </if>
216
+      <if test="secret != null" >
217
+        secret = #{secret,jdbcType=VARCHAR},
218
+      </if>
219
+      <if test="opUserUuid != null" >
220
+        op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
221
+      </if>
222
+      <if test="httpServer != null" >
223
+        http_server = #{httpServer,jdbcType=VARCHAR},
224
+      </if>
225
+      <if test="unitUuids != null" >
226
+        unit_uuids = #{unitUuids,jdbcType=VARCHAR},
227
+      </if>
169 228
     </set>
170 229
     where id = #{id,jdbcType=INTEGER}
171 230
   </update>
@@ -182,7 +241,12 @@
182 241
       update_user = #{updateUser,jdbcType=INTEGER},
183 242
       uuid_id = #{uuidId,jdbcType=INTEGER},
184 243
       equipment_type = #{equipmentType,jdbcType=VARCHAR},
185
-      equipment_tree_id = #{equipmentTreeId,jdbcType=INTEGER}
244
+      equipment_tree_id = #{equipmentTreeId,jdbcType=INTEGER},
245
+      appkey = #{appkey,jdbcType=VARCHAR},
246
+      secret = #{secret,jdbcType=VARCHAR},
247
+      op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
248
+      http_server = #{httpServer,jdbcType=VARCHAR},
249
+      unit_uuids = #{unitUuids,jdbcType=VARCHAR}
186 250
     where id = #{id,jdbcType=INTEGER}
187 251
   </update>
188 252
 </mapper>

+ 199
- 0
CODE/smart-community/app-api/src/main/resources/mapper/TpEquipmentTreeMapper.xml 查看文件

@@ -0,0 +1,199 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TpEquipmentTreeMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpEquipmentTree" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="equipment_name" property="equipmentName" jdbcType="VARCHAR" />
8
+    <result column="pid" property="pid" jdbcType="INTEGER" />
9
+    <result column="sort" property="sort" jdbcType="INTEGER" />
10
+    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
11
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
12
+    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
13
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
14
+    <result column="appkey" property="appkey" jdbcType="VARCHAR" />
15
+    <result column="secret" property="secret" jdbcType="VARCHAR" />
16
+    <result column="op_user_uuid" property="opUserUuid" jdbcType="VARCHAR" />
17
+    <result column="http_server" property="httpServer" jdbcType="VARCHAR" />
18
+    <result column="unit_uuids" property="unitUuids" jdbcType="VARCHAR" />
19
+  </resultMap>
20
+  <sql id="Base_Column_List" >
21
+    id, community_id, equipment_name, pid, sort, create_time, create_user, update_time,
22
+    update_user, appkey, secret, op_user_uuid, http_server, unit_uuids
23
+  </sql>
24
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
25
+    select
26
+    <include refid="Base_Column_List" />
27
+    from tp_equipment_tree
28
+    where id = #{id,jdbcType=INTEGER}
29
+  </select>
30
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
31
+    delete from tp_equipment_tree
32
+    where id = #{id,jdbcType=INTEGER}
33
+  </delete>
34
+  <insert id="insert" parameterType="com.community.huiju.model.TpEquipmentTree" >
35
+    insert into tp_equipment_tree (id, community_id, equipment_name,
36
+      pid, sort, create_time,
37
+      create_user, update_time, update_user,
38
+      appkey, secret, op_user_uuid,
39
+      http_server, unit_uuids)
40
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{equipmentName,jdbcType=VARCHAR},
41
+      #{pid,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
42
+      #{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
43
+      #{appkey,jdbcType=VARCHAR}, #{secret,jdbcType=VARCHAR}, #{opUserUuid,jdbcType=VARCHAR},
44
+      #{httpServer,jdbcType=VARCHAR}, #{unitUuids,jdbcType=VARCHAR})
45
+  </insert>
46
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
47
+    insert into tp_equipment_tree
48
+    <trim prefix="(" suffix=")" suffixOverrides="," >
49
+      <if test="id != null" >
50
+        id,
51
+      </if>
52
+      <if test="communityId != null" >
53
+        community_id,
54
+      </if>
55
+      <if test="equipmentName != null" >
56
+        equipment_name,
57
+      </if>
58
+      <if test="pid != null" >
59
+        pid,
60
+      </if>
61
+      <if test="sort != null" >
62
+        sort,
63
+      </if>
64
+      <if test="createTime != null" >
65
+        create_time,
66
+      </if>
67
+      <if test="createUser != null" >
68
+        create_user,
69
+      </if>
70
+      <if test="updateTime != null" >
71
+        update_time,
72
+      </if>
73
+      <if test="updateUser != null" >
74
+        update_user,
75
+      </if>
76
+      <if test="appkey != null" >
77
+        appkey,
78
+      </if>
79
+      <if test="secret != null" >
80
+        secret,
81
+      </if>
82
+      <if test="opUserUuid != null" >
83
+        op_user_uuid,
84
+      </if>
85
+      <if test="httpServer != null" >
86
+        http_server,
87
+      </if>
88
+      <if test="unitUuids != null" >
89
+        unit_uuids,
90
+      </if>
91
+    </trim>
92
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
93
+      <if test="id != null" >
94
+        #{id,jdbcType=INTEGER},
95
+      </if>
96
+      <if test="communityId != null" >
97
+        #{communityId,jdbcType=INTEGER},
98
+      </if>
99
+      <if test="equipmentName != null" >
100
+        #{equipmentName,jdbcType=VARCHAR},
101
+      </if>
102
+      <if test="pid != null" >
103
+        #{pid,jdbcType=INTEGER},
104
+      </if>
105
+      <if test="sort != null" >
106
+        #{sort,jdbcType=INTEGER},
107
+      </if>
108
+      <if test="createTime != null" >
109
+        #{createTime,jdbcType=TIMESTAMP},
110
+      </if>
111
+      <if test="createUser != null" >
112
+        #{createUser,jdbcType=INTEGER},
113
+      </if>
114
+      <if test="updateTime != null" >
115
+        #{updateTime,jdbcType=TIMESTAMP},
116
+      </if>
117
+      <if test="updateUser != null" >
118
+        #{updateUser,jdbcType=INTEGER},
119
+      </if>
120
+      <if test="appkey != null" >
121
+        #{appkey,jdbcType=VARCHAR},
122
+      </if>
123
+      <if test="secret != null" >
124
+        #{secret,jdbcType=VARCHAR},
125
+      </if>
126
+      <if test="opUserUuid != null" >
127
+        #{opUserUuid,jdbcType=VARCHAR},
128
+      </if>
129
+      <if test="httpServer != null" >
130
+        #{httpServer,jdbcType=VARCHAR},
131
+      </if>
132
+      <if test="unitUuids != null" >
133
+        #{unitUuids,jdbcType=VARCHAR},
134
+      </if>
135
+    </trim>
136
+  </insert>
137
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpEquipmentTree" >
138
+    update tp_equipment_tree
139
+    <set >
140
+      <if test="communityId != null" >
141
+        community_id = #{communityId,jdbcType=INTEGER},
142
+      </if>
143
+      <if test="equipmentName != null" >
144
+        equipment_name = #{equipmentName,jdbcType=VARCHAR},
145
+      </if>
146
+      <if test="pid != null" >
147
+        pid = #{pid,jdbcType=INTEGER},
148
+      </if>
149
+      <if test="sort != null" >
150
+        sort = #{sort,jdbcType=INTEGER},
151
+      </if>
152
+      <if test="createTime != null" >
153
+        create_time = #{createTime,jdbcType=TIMESTAMP},
154
+      </if>
155
+      <if test="createUser != null" >
156
+        create_user = #{createUser,jdbcType=INTEGER},
157
+      </if>
158
+      <if test="updateTime != null" >
159
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
160
+      </if>
161
+      <if test="updateUser != null" >
162
+        update_user = #{updateUser,jdbcType=INTEGER},
163
+      </if>
164
+      <if test="appkey != null" >
165
+        appkey = #{appkey,jdbcType=VARCHAR},
166
+      </if>
167
+      <if test="secret != null" >
168
+        secret = #{secret,jdbcType=VARCHAR},
169
+      </if>
170
+      <if test="opUserUuid != null" >
171
+        op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
172
+      </if>
173
+      <if test="httpServer != null" >
174
+        http_server = #{httpServer,jdbcType=VARCHAR},
175
+      </if>
176
+      <if test="unitUuids != null" >
177
+        unit_uuids = #{unitUuids,jdbcType=VARCHAR},
178
+      </if>
179
+    </set>
180
+    where id = #{id,jdbcType=INTEGER}
181
+  </update>
182
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpEquipmentTree" >
183
+    update tp_equipment_tree
184
+    set community_id = #{communityId,jdbcType=INTEGER},
185
+      equipment_name = #{equipmentName,jdbcType=VARCHAR},
186
+      pid = #{pid,jdbcType=INTEGER},
187
+      sort = #{sort,jdbcType=INTEGER},
188
+      create_time = #{createTime,jdbcType=TIMESTAMP},
189
+      create_user = #{createUser,jdbcType=INTEGER},
190
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
191
+      update_user = #{updateUser,jdbcType=INTEGER},
192
+      appkey = #{appkey,jdbcType=VARCHAR},
193
+      secret = #{secret,jdbcType=VARCHAR},
194
+      op_user_uuid = #{opUserUuid,jdbcType=VARCHAR},
195
+      http_server = #{httpServer,jdbcType=VARCHAR},
196
+      unit_uuids = #{unitUuids,jdbcType=VARCHAR}
197
+    where id = #{id,jdbcType=INTEGER}
198
+  </update>
199
+</mapper>