|
|
@@ -190,53 +190,54 @@ public class ThirdToken {
|
|
190
|
190
|
}
|
|
191
|
191
|
}
|
|
192
|
192
|
}
|
|
193
|
|
- if(kasid==Iot.bmbjyd || kasid==Iot.bmlcyd || kasid==Iot.bmgdyd) {
|
|
194
|
|
- String appId="",openId="",channelId="";
|
|
195
|
|
- if (kasid==Iot.bmbjyd) {
|
|
196
|
|
- appId="C5010100A23100111720247";
|
|
197
|
|
- openId="GFLaxxfVMG4DGkgcdZEEg4zexmje3dq4";
|
|
198
|
|
- channelId="236";
|
|
199
|
|
- } else if (kasid==Iot.bmlcyd){
|
|
200
|
|
- appId="C5010531Aq5201817914";
|
|
201
|
|
- openId="GFLaxxfVMG4DGkgcdZEEg4zexmje3dq4";
|
|
202
|
|
- channelId="216";
|
|
203
|
|
- } else {
|
|
204
|
|
- appId="C5010200A9992002368004";
|
|
205
|
|
- openId="GFLaxxfVMG4DGkgcdZEEg4zexmje3dq4";
|
|
206
|
|
- channelId="239";
|
|
|
193
|
+ if (kasid==Iot.bmlcyd){
|
|
|
194
|
+ String appId="C5010531Aq5201817914";
|
|
|
195
|
+ String openId="GFLaxxfVMG4DGkgcdZEEg4zexmje3dq4";
|
|
|
196
|
+ String channelId="216";
|
|
|
197
|
+ Map<String, String> receivedData = new HashMap<String, String>();
|
|
|
198
|
+ String times=String.valueOf(System.currentTimeMillis()/1000);
|
|
|
199
|
+ receivedData.put("times", times);
|
|
|
200
|
+ receivedData.put("appId", appId);
|
|
|
201
|
+ receivedData.put("channelId", channelId);
|
|
|
202
|
+ TreeMap<String, String> sortedData = new TreeMap<>(receivedData);
|
|
|
203
|
+ // 构建待签名字符串
|
|
|
204
|
+ StringBuilder stringA = new StringBuilder();
|
|
|
205
|
+ stringA.append(openId);
|
|
|
206
|
+ for (Map.Entry<String, String> entry : sortedData.entrySet()) {
|
|
|
207
|
+ String key = entry.getKey();
|
|
|
208
|
+ String value = entry.getValue();
|
|
|
209
|
+ if (value != null && !value.isEmpty() && !"sign".equals(key) ) {
|
|
|
210
|
+ stringA.append(key).append(value);
|
|
|
211
|
+ }
|
|
|
212
|
+ }
|
|
|
213
|
+ // 拼接key,并进行MD5运算
|
|
|
214
|
+ stringA.append(openId);
|
|
|
215
|
+ String signValue = SecureUtil.sha1((stringA.toString())).toUpperCase();
|
|
|
216
|
+ String url="http://db.jinmaiiot.com:7021/api/external/getDeviceToken?appId="+appId+"&openId="+openId+"×="+times+"&sign="+signValue+"&channelId="+channelId;
|
|
|
217
|
+ logger.info("bmlcyd>>>"+url);
|
|
|
218
|
+ String content= HttpUtil.get(url);
|
|
|
219
|
+ logger.info(content);
|
|
|
220
|
+ JSONObject resJson = JSONObject.parseObject(content);
|
|
|
221
|
+ JSONArray result=resJson.getJSONArray("result");
|
|
|
222
|
+ int status=resJson.getIntValue("status");
|
|
|
223
|
+ if(status==0) {
|
|
|
224
|
+ resJson=JSONObject.parseObject(String.valueOf(result.get(0)));
|
|
|
225
|
+ token=resJson.getString("token");
|
|
|
226
|
+ logger.info(token);
|
|
|
227
|
+ }
|
|
|
228
|
+ }
|
|
|
229
|
+ if(kasid==Iot.bmyd) {
|
|
|
230
|
+ String url="http://db.jinmaiiot.com:7021/query/queryYd?method=deviceToken&openId=GFLaxxfVMG4DGkgcdZEEg4zexmje3dq4&msisdn=1442352353017";
|
|
|
231
|
+ logger.info("bmyd>>>"+url);
|
|
|
232
|
+ String content= HttpUtil.get(url);
|
|
|
233
|
+ logger.info(content);
|
|
|
234
|
+ JSONObject resJson = JSONObject.parseObject(content);
|
|
|
235
|
+ JSONObject result=resJson.getJSONObject("result");
|
|
|
236
|
+ int status=resJson.getIntValue("code");
|
|
|
237
|
+ if(status==0) {
|
|
|
238
|
+ token=result.getString("token");
|
|
|
239
|
+ logger.info(token);
|
|
207
|
240
|
}
|
|
208
|
|
- Map<String, String> receivedData = new HashMap<String, String>();
|
|
209
|
|
- String times=String.valueOf(System.currentTimeMillis()/1000);
|
|
210
|
|
- receivedData.put("times", times);
|
|
211
|
|
- receivedData.put("appId", appId);
|
|
212
|
|
- receivedData.put("channelId", channelId);
|
|
213
|
|
- TreeMap<String, String> sortedData = new TreeMap<>(receivedData);
|
|
214
|
|
- // 构建待签名字符串
|
|
215
|
|
- StringBuilder stringA = new StringBuilder();
|
|
216
|
|
- stringA.append(openId);
|
|
217
|
|
- for (Map.Entry<String, String> entry : sortedData.entrySet()) {
|
|
218
|
|
- String key = entry.getKey();
|
|
219
|
|
- String value = entry.getValue();
|
|
220
|
|
- if (value != null && !value.isEmpty() && !"sign".equals(key) ) {
|
|
221
|
|
- stringA.append(key).append(value);
|
|
222
|
|
- }
|
|
223
|
|
- }
|
|
224
|
|
- // 拼接key,并进行MD5运算
|
|
225
|
|
- stringA.append(openId);
|
|
226
|
|
- System.out.println(stringA.toString());
|
|
227
|
|
- String signValue = SecureUtil.sha1((stringA.toString())).toUpperCase();
|
|
228
|
|
- String url="http://db.jinmaiiot.com:7021/api/external/getDeviceToken?appId="+appId+"&openId="+openId+"×="+times+"&sign="+signValue+"&channelId="+channelId;
|
|
229
|
|
- logger.info("bmyd>>>"+url);
|
|
230
|
|
- String content= HttpUtil.get(url);
|
|
231
|
|
- logger.info(content);
|
|
232
|
|
- JSONObject resJson = JSONObject.parseObject(content);
|
|
233
|
|
- JSONArray result=resJson.getJSONArray("result");
|
|
234
|
|
- int status=resJson.getIntValue("status");
|
|
235
|
|
- if(status==0) {
|
|
236
|
|
- resJson=JSONObject.parseObject(String.valueOf(result.get(0)));
|
|
237
|
|
- token=resJson.getString("token");
|
|
238
|
|
- logger.info(token);
|
|
239
|
|
- }
|
|
240
|
241
|
}
|
|
241
|
242
|
if(kasid==Iot.lxxj || kasid==Iot.lxyn || kasid==Iot.lxqh || kasid==Iot.lxgz) {
|
|
242
|
243
|
String appId="";
|