|
|
@@ -4,6 +4,8 @@ import java.util.HashMap;
|
|
4
|
4
|
import java.util.List;
|
|
5
|
5
|
import java.util.Map;
|
|
6
|
6
|
|
|
|
7
|
+import com.nianzai.base.mvc.view.TextView;
|
|
|
8
|
+import com.shuhaiwifi.web.auth2.MacAddressGenerator;
|
|
7
|
9
|
import com.shuhaiwifi.web.auth2.iot.*;
|
|
8
|
10
|
import org.apache.commons.logging.Log;
|
|
9
|
11
|
import org.apache.commons.logging.LogFactory;
|
|
|
@@ -312,77 +314,77 @@ public class Auth2Controller
|
|
312
|
314
|
return new JsonView(mm, CodeEnum.OK.getMessage(), 0);
|
|
313
|
315
|
}
|
|
314
|
316
|
|
|
315
|
|
-// @Path(value="/login.do")
|
|
316
|
|
-// public TextView login(Context context)
|
|
317
|
|
-// {
|
|
318
|
|
-// Map<String, String> para = context.getParas();
|
|
319
|
|
-//
|
|
320
|
|
-// String token="";
|
|
321
|
|
-// String iccid=para.get("iccid");
|
|
322
|
|
-// String mac=para.get("mac");
|
|
323
|
|
-//
|
|
324
|
|
-// String terminalMac=para.get("terminalMac");
|
|
325
|
|
-//
|
|
326
|
|
-// String appid="";
|
|
327
|
|
-//
|
|
328
|
|
-// String client=para.get("c");
|
|
329
|
|
-//
|
|
330
|
|
-// logger.info("mac="+mac+",client="+client+",terminalMac="+terminalMac+",iccid="+iccid);
|
|
331
|
|
-//
|
|
332
|
|
-//
|
|
333
|
|
-// mac=mac.replace(":", "-");
|
|
334
|
|
-// terminalMac=terminalMac.replace(":", "-");
|
|
335
|
|
-//
|
|
336
|
|
-// String op=Iot.getOprtStr(iccid);
|
|
337
|
|
-// String urlo="";
|
|
338
|
|
-// if(op.equals("中国移动") || op.equals("中国电信"))
|
|
339
|
|
-// urlo=appserver + "/device/getKasInfo.do?flag=1&iccid="+iccid;
|
|
340
|
|
-// else
|
|
341
|
|
-// urlo=appserver + "/device/getKasInfo.do?flag=0&iccid="+iccid;
|
|
342
|
|
-// logger.info(urlo);
|
|
343
|
|
-// String resulto = HttpUtil.getContent(urlo,"utf-8");
|
|
344
|
|
-// logger.info(resulto);
|
|
345
|
|
-// if(resulto.length()>1)
|
|
346
|
|
-// {
|
|
347
|
|
-// JSONObject resJsono = JSONObject.parseObject(resulto);
|
|
348
|
|
-// //log.info(resJsono);
|
|
349
|
|
-// JSONObject resJsond = JSONObject.parseObject(resJsono.getString("data"));
|
|
350
|
|
-// String kas=resJsond.getString("kas");
|
|
351
|
|
-// if(!Tools.isEmpty(kas) && kas.length()>1)
|
|
352
|
|
-// {
|
|
353
|
|
-// JSONObject resJsonk = JSONObject.parseObject(resJsond.getString("kas"));
|
|
354
|
|
-// int isp=resJsonk.getIntValue("isp");
|
|
355
|
|
-// int kasid=resJsonk.getIntValue("kasid");//卡商编号
|
|
356
|
|
-// if(isp==3)
|
|
357
|
|
-// {
|
|
358
|
|
-// ;
|
|
359
|
|
-// }
|
|
360
|
|
-// else if(isp==2)
|
|
361
|
|
-// {
|
|
362
|
|
-// ;
|
|
363
|
|
-// }
|
|
364
|
|
-// else if(isp==1)
|
|
365
|
|
-// {
|
|
366
|
|
-// appid=resJsonk.getString("appid");
|
|
367
|
|
-// String paswd=resJsonk.getString("pwd");
|
|
368
|
|
-// token=CmApi.getToken(appid,paswd);
|
|
369
|
|
-// }
|
|
370
|
|
-// else if(isp==4)
|
|
371
|
|
-// {
|
|
372
|
|
-// token=ThirdToken.getToken(kasid, iccid);
|
|
373
|
|
-// logger.info(token);
|
|
374
|
|
-// }
|
|
375
|
|
-// }
|
|
376
|
|
-// }
|
|
377
|
|
-//
|
|
378
|
|
-// context.getRequest().setAttribute("token", token);
|
|
379
|
|
-// context.getRequest().setAttribute("iccid", iccid);
|
|
380
|
|
-// context.getRequest().setAttribute("mac", mac);
|
|
381
|
|
-// context.getRequest().setAttribute("terminalMac", terminalMac);
|
|
382
|
|
-// context.getRequest().setAttribute("appid", appid);
|
|
383
|
|
-//
|
|
384
|
|
-// return new TextView("/login-sms.jsp");
|
|
385
|
|
-// }
|
|
|
317
|
+ @Path(value="/login.do")
|
|
|
318
|
+ public TextView login(Context context)
|
|
|
319
|
+ {
|
|
|
320
|
+ Map<String, String> para = context.getParas();
|
|
|
321
|
+
|
|
|
322
|
+ String token="";
|
|
|
323
|
+ String iccid=para.get("iccid");
|
|
|
324
|
+ String mac= MacAddressGenerator.generateRandomMacAddress();
|
|
|
325
|
+
|
|
|
326
|
+ String terminalMac=MacAddressGenerator.generateRandomMacAddress();
|
|
|
327
|
+
|
|
|
328
|
+ String appid="";
|
|
|
329
|
+
|
|
|
330
|
+ String client=para.get("c");
|
|
|
331
|
+
|
|
|
332
|
+ logger.info("mac="+mac+",client="+client+",terminalMac="+terminalMac+",iccid="+iccid);
|
|
|
333
|
+
|
|
|
334
|
+
|
|
|
335
|
+ mac=mac.replace(":", "-");
|
|
|
336
|
+ terminalMac=terminalMac.replace(":", "-");
|
|
|
337
|
+
|
|
|
338
|
+ String op=Iot.getOprtStr(iccid);
|
|
|
339
|
+ String urlo="";
|
|
|
340
|
+ if(op.equals("中国移动") || op.equals("中国电信"))
|
|
|
341
|
+ urlo=appserver + "/device/getKasInfo.do?flag=1&iccid="+iccid;
|
|
|
342
|
+ else
|
|
|
343
|
+ urlo=appserver + "/device/getKasInfo.do?flag=0&iccid="+iccid;
|
|
|
344
|
+ logger.info(urlo);
|
|
|
345
|
+ String resulto = HttpUtil.getContent(urlo,"utf-8");
|
|
|
346
|
+ logger.info(resulto);
|
|
|
347
|
+ if(resulto.length()>1)
|
|
|
348
|
+ {
|
|
|
349
|
+ JSONObject resJsono = JSONObject.parseObject(resulto);
|
|
|
350
|
+ //log.info(resJsono);
|
|
|
351
|
+ JSONObject resJsond = JSONObject.parseObject(resJsono.getString("data"));
|
|
|
352
|
+ String kas=resJsond.getString("kas");
|
|
|
353
|
+ if(!Tools.isEmpty(kas) && kas.length()>1)
|
|
|
354
|
+ {
|
|
|
355
|
+ JSONObject resJsonk = JSONObject.parseObject(resJsond.getString("kas"));
|
|
|
356
|
+ int isp=resJsonk.getIntValue("isp");
|
|
|
357
|
+ int kasid=resJsonk.getIntValue("kasid");//卡商编号
|
|
|
358
|
+ if(isp==3)
|
|
|
359
|
+ {
|
|
|
360
|
+ ;
|
|
|
361
|
+ }
|
|
|
362
|
+ else if(isp==2)
|
|
|
363
|
+ {
|
|
|
364
|
+ ;
|
|
|
365
|
+ }
|
|
|
366
|
+ else if(isp==1)
|
|
|
367
|
+ {
|
|
|
368
|
+ appid=resJsonk.getString("appid");
|
|
|
369
|
+ String paswd=resJsonk.getString("pwd");
|
|
|
370
|
+ token=CmApi.getToken(appid,paswd);
|
|
|
371
|
+ }
|
|
|
372
|
+ else if(isp==4)
|
|
|
373
|
+ {
|
|
|
374
|
+ token=ThirdToken.getToken(kasid, iccid);
|
|
|
375
|
+ logger.info(token);
|
|
|
376
|
+ }
|
|
|
377
|
+ }
|
|
|
378
|
+ }
|
|
|
379
|
+
|
|
|
380
|
+ context.getRequest().setAttribute("token", token);
|
|
|
381
|
+ context.getRequest().setAttribute("iccid", iccid);
|
|
|
382
|
+ context.getRequest().setAttribute("mac", mac);
|
|
|
383
|
+ context.getRequest().setAttribute("terminalMac", terminalMac);
|
|
|
384
|
+ context.getRequest().setAttribute("appid", appid);
|
|
|
385
|
+
|
|
|
386
|
+ return new TextView("/login-sms.jsp");
|
|
|
387
|
+ }
|
|
386
|
388
|
|
|
387
|
389
|
@Path(value="/sms.do")
|
|
388
|
390
|
public JsonView sms(Context context)
|