|
@@ -3,10 +3,8 @@ package com.happy.action;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
|
|
+import com.happy.Model.*;
|
|
|
import com.happy.Model.AdminManager;
|
|
import com.happy.Model.AdminManager;
|
|
|
-import com.happy.Model.AdminManager;
|
|
|
|
|
-import com.happy.Model.AdminPower;
|
|
|
|
|
-import com.happy.Model.File;
|
|
|
|
|
import com.happy.Until.GetHttpParam;
|
|
import com.happy.Until.GetHttpParam;
|
|
|
import com.happy.Until.PwdDefind;
|
|
import com.happy.Until.PwdDefind;
|
|
|
import com.happy.Until.ResUtil;
|
|
import com.happy.Until.ResUtil;
|
|
@@ -15,6 +13,7 @@ import com.happy.dto.IPage;
|
|
|
import com.happy.service.AdminManagerService;
|
|
import com.happy.service.AdminManagerService;
|
|
|
import com.happy.service.AdminService;
|
|
import com.happy.service.AdminService;
|
|
|
import com.happy.service.FileService;
|
|
import com.happy.service.FileService;
|
|
|
|
|
+import com.happy.service.HotelService;
|
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
import com.opensymphony.xwork2.ActionSupport;
|
|
|
import net.sf.json.JSONObject;
|
|
import net.sf.json.JSONObject;
|
|
|
import org.apache.struts2.ServletActionContext;
|
|
import org.apache.struts2.ServletActionContext;
|
|
@@ -37,12 +36,17 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
public AdminManagerService adminManagerService;
|
|
public AdminManagerService adminManagerService;
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
|
|
+ public HotelService hotelService;
|
|
|
|
|
+
|
|
|
|
|
+ @Resource
|
|
|
public FileService fileService;
|
|
public FileService fileService;
|
|
|
|
|
|
|
|
public String adminName;
|
|
public String adminName;
|
|
|
public String password;
|
|
public String password;
|
|
|
public String hotelTownship;
|
|
public String hotelTownship;
|
|
|
|
|
+ public Integer managerId;//商户Id
|
|
|
public Integer id;
|
|
public Integer id;
|
|
|
|
|
+ public String level;//权限
|
|
|
public int page; // 当前页
|
|
public int page; // 当前页
|
|
|
public int rows;// 每页显示的行数rows
|
|
public int rows;// 每页显示的行数rows
|
|
|
|
|
|
|
@@ -77,12 +81,26 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
.append(" and password = '").append(password).append("'");
|
|
.append(" and password = '").append(password).append("'");
|
|
|
AdminManager login = adminManagerService.getOen(getOneSqlx.toString());
|
|
AdminManager login = adminManagerService.getOen(getOneSqlx.toString());
|
|
|
if (login != null) {
|
|
if (login != null) {
|
|
|
- login.setPassword("********");
|
|
|
|
|
- resultJson.put("message", "登录成功");
|
|
|
|
|
- resultJson.put("code", 200);
|
|
|
|
|
- resultJson.put("data", login);
|
|
|
|
|
- ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ if(login.getStatus()==2){
|
|
|
|
|
+ resultJson.put("message", "账号已冻结请联系管理员");
|
|
|
|
|
+ resultJson.put("code", 205);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //是否主账号首次登录
|
|
|
|
|
+ Hotel hotel = hotelService.getOen("and manager_id = '"+login.getId()+"'");
|
|
|
|
|
+ if(hotel==null && hotel.getManagerId().equals(login.getId())){
|
|
|
|
|
+ resultJson.put("isLogin",1);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ resultJson.put("isLogin",0);
|
|
|
|
|
+ }
|
|
|
|
|
+ login.setPassword("********");
|
|
|
|
|
+ resultJson.put("message", "登录成功");
|
|
|
|
|
+ resultJson.put("code", 200);
|
|
|
|
|
+ resultJson.put("data", login);
|
|
|
|
|
+ ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
resultJson.put("message", "用户名或密码错误");
|
|
resultJson.put("message", "用户名或密码错误");
|
|
|
resultJson.put("code", 205);
|
|
resultJson.put("code", 205);
|
|
@@ -135,6 +153,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
admin.setId(Math.toIntExact(UUIDUtil.generateID()));
|
|
admin.setId(Math.toIntExact(UUIDUtil.generateID()));
|
|
|
|
|
+ admin.setManagerId(admin.getId());
|
|
|
//保存详细图附件
|
|
//保存详细图附件
|
|
|
List<File> fileList = JSONArray.parseArray(admin.getFileListJson(), File.class);
|
|
List<File> fileList = JSONArray.parseArray(admin.getFileListJson(), File.class);
|
|
|
if(fileList!=null && fileList.size()>0){
|
|
if(fileList!=null && fileList.size()>0){
|
|
@@ -196,7 +215,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- if (admin.getAdminName()==null || admin.getHotelName()==null || admin.getHotelTownship()==null
|
|
|
|
|
|
|
+ if (admin.getAdminName()==null || admin.getCorpnName()==null || admin.getHotelTownship()==null
|
|
|
|| admin.getLevel()==null || admin.getCardName()==null || admin.getCorpnPhone()==null){
|
|
|| admin.getLevel()==null || admin.getCardName()==null || admin.getCorpnPhone()==null){
|
|
|
resultJson.put("message", "各参数不能为空");
|
|
resultJson.put("message", "各参数不能为空");
|
|
|
resultJson.put("code", 500);
|
|
resultJson.put("code", 500);
|
|
@@ -277,7 +296,7 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
ResUtil.writeJson(ServletActionContext.getResponse(), resultJson.toString());
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
- if (admin.getAdminName()==null || admin.getCardName()==null || admin.getCorpnPhone()==null
|
|
|
|
|
|
|
+ if (admin.getAdminName()==null || admin.getCorpnName()==null || admin.getCorpnPhone()==null
|
|
|
|| admin.getLevel()==null || admin.getPassword()==null){
|
|
|| admin.getLevel()==null || admin.getPassword()==null){
|
|
|
resultJson.put("message", "各参数不能为空");
|
|
resultJson.put("message", "各参数不能为空");
|
|
|
resultJson.put("code", 500);
|
|
resultJson.put("code", 500);
|
|
@@ -523,7 +542,13 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
s1.append(" and admin_name like '%").append(adminName).append("%'");
|
|
s1.append(" and admin_name like '%").append(adminName).append("%'");
|
|
|
}
|
|
}
|
|
|
if (hotelTownship!=null){
|
|
if (hotelTownship!=null){
|
|
|
- s1.append(" and hotel_township like '%").append(hotelTownship).append("'");
|
|
|
|
|
|
|
+ s1.append(" and hotel_township = '").append(hotelTownship).append("'");
|
|
|
|
|
+ }
|
|
|
|
|
+ if(managerId!=null){
|
|
|
|
|
+ s1.append(" and manager_id = ").append(managerId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(level!=null){
|
|
|
|
|
+ s1.append(" and level = '").append(level).append("'");
|
|
|
}
|
|
}
|
|
|
IPage<AdminManager> adminIPage = adminManagerService.queryPage(s1.toString(),page,rows);
|
|
IPage<AdminManager> adminIPage = adminManagerService.queryPage(s1.toString(),page,rows);
|
|
|
if(adminIPage!=null && !"".equals(adminIPage)){
|
|
if(adminIPage!=null && !"".equals(adminIPage)){
|
|
@@ -552,6 +577,8 @@ public class adminManagerAction extends ActionSupport implements ServletRequestA
|
|
|
return null;
|
|
return null;
|
|
|
}
|
|
}
|
|
|
AdminManager admin = adminManagerService.getById(id);
|
|
AdminManager admin = adminManagerService.getById(id);
|
|
|
|
|
+ List<File> fileList = fileService.queryList("and link_id ='"+id+"'");
|
|
|
|
|
+ admin.setFileList(fileList);
|
|
|
if (admin != null) {
|
|
if (admin != null) {
|
|
|
resultJson.put("message", "查询成功");
|
|
resultJson.put("message", "查询成功");
|
|
|
resultJson.put("code", 200);
|
|
resultJson.put("code", 200);
|