//
|
// Source code recreated from a .class file by IntelliJ IDEA
|
// (powered by FernFlower decompiler)
|
//
|
|
package com.hxzkoa.controller;
|
|
import com.hxzkoa.json.tb_login;
|
import com.hxzkoa.json.tb_user;
|
import com.hxzkoa.services.LoginService;
|
import com.hxzkoa.udp.Baowen_Receive;
|
import com.hxzkoa.udp.Dell_tag_reg_ms;
|
import com.hxzkoa.udp.Gas_Receive;
|
import com.hxzkoa.udp.Gps_Receive;
|
import com.hxzkoa.udp.Transfer_Receive;
|
import com.hxzkoa.udp.Yuanshi_Receive;
|
import com.hxzkoa.udp.Zhuce_Receive;
|
import com.hxzkoa.util.Config;
|
import com.hxzkoa.util.ModifyConfig;
|
import com.hxzkoa.util.PageUtil;
|
import java.io.File;
|
import java.io.IOException;
|
import java.util.List;
|
import javax.servlet.ServletContext;
|
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpSession;
|
import net.sf.json.JSONObject;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Controller;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
@Controller
|
public class LoginController {
|
@Autowired
|
private LoginService loginService;
|
Gps_Receive receive2;
|
Transfer_Receive receive3;
|
Yuanshi_Receive receive4;
|
Gas_Receive receive5;
|
Zhuce_Receive receive6;
|
Baowen_Receive receive7;
|
Dell_tag_reg_ms thread1;
|
|
public LoginController() {
|
}
|
|
@RequestMapping(
|
value = {"/login.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
@ResponseBody
|
public String login(HttpServletRequest request) {
|
String username = request.getParameter("username");
|
String password = request.getParameter("password");
|
tb_user user = this.loginService.login(username);
|
String result = "0";
|
String db_password = user.getPassword();
|
if (password.equals(db_password)) {
|
HttpSession session = request.getSession();
|
ServletContext application = session.getServletContext();
|
application.setAttribute("username", user.getUsername());
|
application.setAttribute("password", user.getPassword());
|
application.setAttribute("superuser", user.getSuperuser());
|
application.setAttribute("deleteq", user.getDeleteq());
|
application.setAttribute("alertq", user.getAlertq());
|
application.setAttribute("deleteall", user.getDeleteall());
|
application.setAttribute("fenceq", user.getFenceq());
|
session.setAttribute("username", user.getUsername());
|
session.setAttribute("password", user.getPassword());
|
session.setAttribute("superuser", user.getSuperuser());
|
session.setAttribute("deleteq", user.getDeleteq());
|
session.setAttribute("alertq", user.getAlertq());
|
session.setAttribute("deleteall", user.getDeleteall());
|
session.setAttribute("fenceq", user.getFenceq());
|
result = "1";
|
String var9 = (String)application.getAttribute("username");
|
}
|
|
File fileBaowen = new File(Config.getBaowenConfig());
|
if (!fileBaowen.exists()) {
|
try {
|
fileBaowen.createNewFile();
|
} catch (IOException var19) {
|
var19.printStackTrace();
|
}
|
}
|
|
File fileAnchor = new File(Config.getAnchorConfig());
|
if (!fileAnchor.exists()) {
|
try {
|
fileAnchor.createNewFile();
|
} catch (IOException var18) {
|
var18.printStackTrace();
|
}
|
}
|
|
File fileMap = new File(Config.getMapConfig());
|
if (!fileMap.exists()) {
|
try {
|
fileMap.createNewFile();
|
} catch (IOException var17) {
|
var17.printStackTrace();
|
}
|
}
|
|
File filePage = new File(Config.getPageConfig());
|
if (!filePage.exists()) {
|
try {
|
filePage.createNewFile();
|
} catch (IOException var16) {
|
var16.printStackTrace();
|
}
|
}
|
|
String perPage = Config.getPageConfig();
|
ModifyConfig.writeData(perPage, "perPage", "10");
|
String BaowenPath = Config.getBaowenConfig();
|
ModifyConfig.writeData(BaowenPath, "baowenSwitch", "0");
|
ModifyConfig.writeData(BaowenPath, "debugSwitch", "0");
|
ModifyConfig.writeData(BaowenPath, "yuanshiMessage", "");
|
ModifyConfig.writeData(BaowenPath, "udpMessage", "3");
|
String data = ModifyConfig.readData(BaowenPath, "udpMessage");
|
ModifyConfig.writeData(BaowenPath, "tcpMessage", "");
|
ModifyConfig.writeData(BaowenPath, "gasMessage", "");
|
ModifyConfig.writeData(BaowenPath, "hexMessage", "");
|
ModifyConfig.writeData(BaowenPath, "mysqlMessage", "");
|
ModifyConfig.writeData(BaowenPath, "debugMessage", "");
|
ModifyConfig.writeData(BaowenPath, "zhuceMessage", "");
|
ModifyConfig.writeData(BaowenPath, "allMessage", "");
|
String MapPath = Config.getMapConfig();
|
ModifyConfig.writeData(MapPath, "map_now", "百度地图");
|
String AnchorPath = Config.getAnchorConfig();
|
ModifyConfig.writeData(AnchorPath, "shebeimoshi", "");
|
ModifyConfig.writeData(AnchorPath, "zhudongceju", "");
|
ModifyConfig.writeData(AnchorPath, "kaiqixintiao", "");
|
ModifyConfig.writeData(AnchorPath, "jizhanid", "");
|
ModifyConfig.writeData(AnchorPath, "fashegonglv", "");
|
ModifyConfig.writeData(AnchorPath, "wuchajiaozhun", "");
|
ModifyConfig.writeData(AnchorPath, "lvbocanshu", "");
|
ModifyConfig.writeData(AnchorPath, "tongxunxiaozu", "");
|
ModifyConfig.writeData(AnchorPath, "tongxunpinlv", "");
|
ModifyConfig.writeData(AnchorPath, "tongxunshangxian", "");
|
ModifyConfig.writeData(AnchorPath, "gujianbanben", "");
|
ModifyConfig.writeData(AnchorPath, "tongbujizhan", "");
|
ModifyConfig.writeData(AnchorPath, "tongbuleixing", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhanshuliang", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan1", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan2", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan3", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan4", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan5", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan6", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan7", "");
|
ModifyConfig.writeData(AnchorPath, "linjinjizhan8", "");
|
ModifyConfig.writeData(AnchorPath, "qiehuanjuli", "");
|
ModifyConfig.writeData(AnchorPath, "anchorid", "");
|
ModifyConfig.writeData(AnchorPath, "anchorip", "");
|
ModifyConfig.writeData(AnchorPath, "readpeizhi", "");
|
ModifyConfig.writeData(AnchorPath, "beice_anchor", "");
|
ModifyConfig.writeData(AnchorPath, "huceju", "");
|
return result;
|
}
|
|
@RequestMapping(
|
value = {"/logout.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
public String logout(HttpServletRequest request) throws Exception {
|
HttpSession session = request.getSession();
|
ServletContext application = session.getServletContext();
|
application.removeAttribute("username");
|
application.removeAttribute("password");
|
application.removeAttribute("superuser");
|
application.removeAttribute("deleteq");
|
application.removeAttribute("alertq");
|
application.removeAttribute("deleteall");
|
application.removeAttribute("fenceq");
|
session.removeAttribute("username");
|
session.removeAttribute("password");
|
session.removeAttribute("superuser");
|
session.removeAttribute("deleteq");
|
session.removeAttribute("alertq");
|
session.removeAttribute("deleteall");
|
session.removeAttribute("fenceq");
|
if (Config.getUdpRunning().equals("1")) {
|
try {
|
this.receive3.stopThread();
|
} catch (Exception var5) {
|
var5.printStackTrace();
|
}
|
}
|
|
return "redirect:/hxzk/login.jsp";
|
}
|
|
@RequestMapping(
|
value = {"/loginfa.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
public String loginfa(HttpServletRequest request) throws Exception {
|
String toPage = "forward:/hxzk/sysSetting/loginfa.jsp";
|
List<tb_login> logins = this.loginService.getloginManagement(1);
|
int curPage = 1;
|
int count = this.loginService.getloginManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
request.setAttribute("dataList", logins);
|
request.setAttribute("pageList", PageUtil.getPage(minPage));
|
request.setAttribute("curPage", Integer.valueOf(curPage));
|
return toPage;
|
}
|
|
@ResponseBody
|
@RequestMapping(
|
value = {"findloginid.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
public JSONObject findloginid(HttpServletRequest request) throws Exception {
|
JSONObject json = new JSONObject();
|
String username = request.getParameter("input");
|
List<tb_login> logins = this.loginService.getloginid(username);
|
json.put("dataList", logins);
|
return json;
|
}
|
|
@ResponseBody
|
@RequestMapping(
|
value = {"/loginManagement_page.do"},
|
method = {RequestMethod.POST, RequestMethod.GET}
|
)
|
public String loginManagement_page(HttpServletRequest request) {
|
String pageStr = request.getParameter("page");
|
String curPageStr = request.getParameter("curPage");
|
int count = this.loginService.getloginManagementCount();
|
int minPage = PageUtil.getMinPage(count);
|
int curPage = Integer.parseInt(curPageStr);
|
int page = 1;
|
if ("pre".equals(pageStr)) {
|
if (curPage > 1) {
|
page = curPage - 1;
|
}
|
} else if ("next".equals(pageStr)) {
|
if (curPage < minPage) {
|
page = curPage + 1;
|
}
|
} else {
|
page = Integer.parseInt(pageStr);
|
}
|
|
List<tb_login> loginManagementList = this.loginService.getloginManagement(page);
|
List<Integer> pageList = PageUtil.getPage(PageUtil.getLocPage(page, curPage), page, minPage);
|
JSONObject json = new JSONObject();
|
json.put("dataList", loginManagementList);
|
json.put("pageList", pageList);
|
json.put("curPage", page);
|
return json.toString();
|
}
|
}
|