liujh 3 lat temu
rodzic
commit
e3830d5aaf

+ 19 - 23
zd-modules/zd-smartlock/src/main/java/com/zd/smartlock/utils/SmartlockUtil.java

@@ -77,12 +77,11 @@ public class SmartlockUtil {
             if (SmartlockUtil.resultMsg.equals(resultMsg)) {
                 token = JSON.parseObject(JSON.parseObject(response.body()).get("result").toString()).get("token").toString();
             } else {
-                logger.error("智能锁获取token失败:" + resultMsg);
+                logger.info("智能锁获取token失败:" + resultMsg);
             }
         } catch (Exception e) {
-            logger.error("获取token失败:" + e);
+            logger.info("获取token失败:" + e);
         }
-        System.out.println(token);
         return token;
     }
 
@@ -96,7 +95,7 @@ public class SmartlockUtil {
             String url = SmartlockUtil.serviceurl + "/build/1/getbuild?buildfatherid=0&page=1&rows=10&token=" + token;
             HttpRequest request = SmartlockUtil.httpSendPost(url, "");
             HttpResponse response = request.execute();
-            System.out.println(response.body());
+            // System.out.println(response.body());
             String resultMsg = JSON.parseObject(response.body().toString()).get("resultMsg").toString();
             if (SmartlockUtil.resultMsg.equals(resultMsg)) {
                 List<SlBuild> list = JSON.parseArray(JSON.parseObject(response.body().toString()).get("result").toString(), SlBuild.class);
@@ -118,7 +117,7 @@ public class SmartlockUtil {
         SlBuild slBuild = null;
         String token = SmartlockUtil.getToken();
         List<SlRoom> listRoom = new ArrayList<>();
-        System.out.println(token);
+        // System.out.println(token);
         try {
             //获取楼层建筑id
             String urlLc = SmartlockUtil.serviceurl + "/build/1/getbuild?buildid=0&page=1&rows=30&token=" + token;
@@ -133,7 +132,6 @@ public class SmartlockUtil {
             }
             String data = JSON.parseObject(JSON.parseObject(str).get("result").toString()).get("data").toString();
             List<SlBuild> listLc = JSON.parseArray(data, SlBuild.class);
-            System.out.println(listLc.size());
             for (SlBuild build : listLc) {
                 if ("3".equals(build.getBuildtype())) {
                     slBuild = build;
@@ -215,7 +213,7 @@ public class SmartlockUtil {
             lockOnline.setOnLine(roomnetquality);
             lockOnline.setLockCode(lockCode);
             lockOnline.setOnLineStatus("在线".equals(roomnetquality)?1:0);
-            System.out.println("房间详情,门锁状态 roomnetquality: " + roomnetquality + " lockCode: " + lockCode);
+            // System.out.println("房间详情,门锁状态 roomnetquality: " + roomnetquality + " lockCode: " + lockCode);
         } catch (Exception e) {
             logger.error("获取房间详情失败2:" + e);
         }
@@ -249,7 +247,7 @@ public class SmartlockUtil {
                     + "&search=" + openDoorSearch.getSearch() + "&sdate=" + sdate + "&edate=" + edate;
             HttpRequest request = SmartlockUtil.httpSendPost(url, "");
             HttpResponse response = request.execute();
-            System.out.println(response.body());
+            // System.out.println(response.body());
             //查询失败直接返回
             String resultMsg = JSON.parseObject(response.body()).get("resultMsg").toString();
             if (!SmartlockUtil.resultMsg.equals(resultMsg)) {
@@ -321,10 +319,10 @@ public class SmartlockUtil {
                         "&personmobile=" + user.getPersonmobile() + "&persontype=" + user.getPersontype() + "&pgid=" + pgid + "&token=" + token;
                 HttpRequest request = SmartlockUtil.httpSendPost(url, "");
                 HttpResponse response = request.execute();
-                System.out.println(response.body());
+                // System.out.println(response.body());
                 //查询失败直接返回
                 String resultMsg = JSON.parseObject(response.body().toString()).get("resultMsg").toString();
-                System.out.println(resultMsg);
+                // System.out.println(resultMsg);
                 if (!SmartlockUtil.resultMsg.equals(resultMsg)) {
                     logger.error("人员添加失败1:" + resultMsg);
                     map.put("resultMsg", resultMsg);
@@ -378,14 +376,14 @@ public class SmartlockUtil {
             HttpResponse response2 = request2.execute();
             String resultMsg = JSON.parseObject(response2.body()).get("resultMsg").toString();
             logger.info("用户申请修改:"+response2.body());
-            System.out.println(response2.body());
+            // System.out.println(response2.body());
             logger.info("用户密码:"+pw);
-            System.out.println(pw);
+            // System.out.println(pw);
             map.put("password", pw);
             map.put("resultMsg", resultMsg);
         } catch (Exception e) {
             logger.error("修改用户授权失败" + e);
-            System.out.println("修改用户授权失败:" + resultMsg);
+            // System.out.println("修改用户授权失败:" + resultMsg);
         }
         return map;
     }
@@ -404,7 +402,6 @@ public class SmartlockUtil {
             //入住办理
             JSONObject json = new JSONObject();
             String pw = getRandom(6);
-            System.out.println(pw);
             List<SlPostUser> postlist = new ArrayList<>();
             SlPostUser postUser = new SlPostUser();
             postUser.setPersoncode(personcode);//学号、工号
@@ -416,14 +413,14 @@ public class SmartlockUtil {
             postUser.setEmpsdate(sdf.format(new Date()));//授权开始时间
             postUser.setEmpedate(sdf.format(getTime(authsLength)));  //授权结束时间,当前时间加1小时
             postlist.add(postUser);
-            System.out.println("开始时间:" + sdf.format(new Date()) + "结束时间:" + sdf.format(getTime(1)));
+            //System.out.println("开始时间:" + sdf.format(new Date()) + "结束时间:" + sdf.format(getTime(1)));
 
             //将对象转为json
             //JSONObject jsonStr = JSON.parseObject(JSONObject.toJSONString( postlist ));
             String url2 = SmartlockUtil.serviceurl + "/lockauth/save/4/saveauths?token=" + token + "&roomid=" + roomId;
             HttpRequest request2 = SmartlockUtil.httpSendPost(url2, JSONObject.toJSONString(postlist));
             HttpResponse response2 = request2.execute();
-            System.out.println(response2.body());
+            //System.out.println(response2.body());
             //查询失败直接返回
             if (!SmartlockUtil.resultMsg.equals(resultMsg)) {
                 logger.error("人员添加后办理入住失败1:" + resultMsg);
@@ -467,10 +464,10 @@ public class SmartlockUtil {
                     "&persontype=" + user.getPersontype() + "&pgid=" + pgid + "&token=" + token;
             HttpRequest request = SmartlockUtil.httpSendPost(url, "");
             HttpResponse response = request.execute();
-            System.out.println(response.body());
+            //System.out.println(response.body());
             //查询失败直接返回
             String resultMsg = JSON.parseObject(response.body().toString()).get("resultMsg").toString();
-            System.out.println(resultMsg);
+            //System.out.println(resultMsg);
             if (!SmartlockUtil.resultMsg.equals(resultMsg)) {
                 logger.error("人员添加失败1:" + resultMsg);
                 map.put("resultMsg", resultMsg);
@@ -480,7 +477,6 @@ public class SmartlockUtil {
 
         //入住办理
         String pw = getRandom(6);
-        System.out.println(pw);
         List<SlPostUser> postlist = new ArrayList<>();
         SlPostUser postUser = new SlPostUser();
         postUser.setPersoncode("C010");//学号、工号
@@ -499,7 +495,7 @@ public class SmartlockUtil {
         String url2 = SmartlockUtil.serviceurl + "/lockauth/operate/9/batchauths?token=" + token;
         HttpRequest request2 = SmartlockUtil.httpSendPost(url2, JSONObject.toJSONString(postlist));
         HttpResponse response2 = request2.execute();
-        System.out.println(response2.body());
+        //System.out.println(response2.body());
         //查询失败直接返回
         if (!SmartlockUtil.resultMsg.equals(resultMsg)) {
             logger.error("人员添加后办理入住失败1:" + resultMsg);
@@ -524,7 +520,7 @@ public class SmartlockUtil {
         String urlexis = SmartlockUtil.serviceurl + "/card/save/8/getcardperson?token=" + token + "&cardtype=" + cardtype + "&page=1&rows=20&search=" + personcode;
         HttpRequest requestexis = SmartlockUtil.httpSendPost(urlexis, "");
         HttpResponse responseexis = requestexis.execute();
-        System.out.println(responseexis.body());
+        //System.out.println(responseexis.body());
         String data = JSON.parseObject(JSON.parseObject(responseexis.body()).get("result").toString()).get("data").toString();
         JSONArray array = JSON.parseArray(data);
         if (array.size() > 0) {
@@ -547,12 +543,12 @@ public class SmartlockUtil {
                 "personcode=" + personcode + "&page=1" + "&rows=50&token=" + token;
         HttpRequest requestauth = SmartlockUtil.httpSendPost(urlauth, "");
         HttpResponse responseauth = requestauth.execute();
-        System.out.println(responseauth.body());
+        //System.out.println(responseauth.body());
 
         String data = JSON.parseObject(JSON.parseObject(responseauth.body()).get("result").toString()).get("data").toString();
         JSONArray array = JSON.parseArray(data);
         for (int i = 0; i < array.size(); i++) {
-            System.out.println(array.get(i) + "");
+            //System.out.println(array.get(i) + "");
             String empedate = JSON.parseObject(array.get(i).toString()).get("empedate").toString();
             String authtype = JSON.parseObject(array.get(i).toString()).get("authtype").toString();
             if ("3".equals(authtype)) {