Browse Source

冻结跟解冻修改

raojiaolong@163.com 2 years ago
parent
commit
2852ad7b70

+ 4 - 7
mhotel/src/com/happy/action/adminAction.java

@@ -134,9 +134,6 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            resultJson.put("message", "未知异常:"+ e);
-            resultJson.put("code", 205);
-            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }
         resultJson.put("message", "未知异常");
         resultJson.put("code", 205);
@@ -208,9 +205,6 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            resultJson.put("message", "未知异常:"+ e);
-            resultJson.put("code", 205);
-            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }
         resultJson.put("message", "未知异常");
         resultJson.put("code", 205);
@@ -329,7 +323,10 @@ public class adminAction extends ActionSupport implements ServletRequestAware {
         }
     }
 
-    // 菜单查询
+    /**
+     * 描述:查询菜单
+     * @return
+     */
     public String getIndexList(){
         JSONObject resultjson = new JSONObject();
         StringBuilder s1 = new StringBuilder("");

+ 76 - 13
mhotel/src/com/happy/action/adminManagerAction.java

@@ -111,12 +111,12 @@ public class adminManagerAction extends ActionSupport {
                 ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
                 return null;
             }
-//            if (!PwdDefind.vertify(admin.getPassword())){
-//                resultJson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
-//                resultJson.put("code", 500);
-//                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
-//                return null;
-//            }
+            if (!PwdDefind.vertify(admin.getPassword())){
+                resultJson.put("message", "密码至少包含:大小写英文字母、数字、特殊符号,密码长度大于8位,小于20位");
+                resultJson.put("code", 500);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
             StringBuilder getOneSqlx = new StringBuilder("");
             getOneSqlx.append(" and admin_name = '").append(admin.getAdminName()).append("'");
             AdminManager listc = adminManagerService.getOen(getOneSqlx.toString());
@@ -140,9 +140,6 @@ public class adminManagerAction extends ActionSupport {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            resultJson.put("message", "未知异常:"+ e);
-            resultJson.put("code", 205);
-            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }
         resultJson.put("message", "未知异常");
         resultJson.put("code", 205);
@@ -215,9 +212,6 @@ public class adminManagerAction extends ActionSupport {
             }
         } catch (Exception e) {
             e.printStackTrace();
-            resultJson.put("message", "未知异常:"+ e);
-            resultJson.put("code", 205);
-            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         }
         resultJson.put("message", "未知异常");
         resultJson.put("code", 205);
@@ -283,6 +277,72 @@ public class adminManagerAction extends ActionSupport {
         ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
         return null;
     }
+    /**
+     * 描述:冻结账号
+     * @return
+     */
+    public String freezeAdmin(){
+        JSONObject resultJson = new JSONObject();
+        if (id == null) {
+            resultJson.put("message", "请传入id");
+            resultJson.put("code", 500);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        AdminManager admin = adminManagerService.getById(id);
+        if (admin != null && !"".equals(admin)) {
+            admin.setStatus(0);
+            int m = adminManagerService.updateAdmin(admin);
+            if(m > 0){
+                resultJson.put("message", "冻结成功");
+                resultJson.put("code", 200);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }else{
+                resultJson.put("message", "冻结失败");
+                resultJson.put("code", 502);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+        }
+        resultJson.put("message", "未知异常");
+        resultJson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+    }
+    /**
+     * 描述:解冻账号
+     * @return
+     */
+    public String thawAdmin(){
+        JSONObject resultJson = new JSONObject();
+        if (id == null) {
+            resultJson.put("message", "请传入id");
+            resultJson.put("code", 500);
+            ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+            return null;
+        }
+        AdminManager admin = adminManagerService.getById(id);
+        if (admin != null && !"".equals(admin)) {
+            admin.setStatus(1);
+            int m = adminManagerService.updateAdmin(admin);
+            if(m > 0){
+                resultJson.put("message", "解冻成功");
+                resultJson.put("code", 200);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }else{
+                resultJson.put("message", "解冻成功");
+                resultJson.put("code", 502);
+                ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+                return null;
+            }
+        }
+        resultJson.put("message", "未知异常");
+        resultJson.put("code", 205);
+        ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
+        return null;
+    }
 
 
     /**
@@ -336,7 +396,10 @@ public class adminManagerAction extends ActionSupport {
         }
     }
 
-    // 菜单查询
+    /**
+     * 描述:查询菜单
+     * @return
+     */
     public String getIndexList(){
         JSONObject resultjson = new JSONObject();
         StringBuilder s1 = new StringBuilder("");

+ 1 - 1
mhotel/src/com/happy/dao/impl/AdminManagerImplDao.java

@@ -46,7 +46,7 @@ public class AdminManagerImplDao implements AdminManagerDao {
         sps.addValue("bank_name", adminManager.getBankName());
         sps.addValue("create_id", adminManager.getCreateId());
         sps.addValue("create_date",adminManager.getCreateDate());
-        sps.addValue("status", adminManager.getStatus());
+        sps.addValue("status", 1);
         if(adminManager.getId()==null){
             sps.addValue("id", UUIDUtil.generateID());
         }