You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1634 lines
67 KiB
1634 lines
67 KiB
10 months ago
|
package com.fy.www._base;
|
||
|
|
||
|
import java.io.File;
|
||
|
import java.io.FileInputStream;
|
||
|
import java.io.FileReader;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InputStreamReader;
|
||
|
import java.io.Reader;
|
||
|
import java.net.URLEncoder;
|
||
|
import java.text.SimpleDateFormat;
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.Date;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
import javax.annotation.Resource;
|
||
|
import javax.servlet.http.Cookie;
|
||
|
import javax.servlet.http.HttpServletRequest;
|
||
|
import javax.servlet.http.HttpServletResponse;
|
||
|
import javax.servlet.http.HttpSession;
|
||
|
|
||
|
import org.springframework.stereotype.Controller;
|
||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||
|
|
||
|
import com.alibaba.fastjson.JSON;
|
||
|
import com.alibaba.fastjson.JSONArray;
|
||
|
import com.alibaba.fastjson.JSONObject;
|
||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||
|
import com.fy.web.handler.CacheHandler;
|
||
|
import com.fy.web.helper.CoodinateCovertor;
|
||
|
import com.fy.www.admin.pojo.Group;
|
||
|
import com.fy.www.admin.pojo.Menu;
|
||
|
import com.fy.www.admin.pojo.SysLogrecord;
|
||
|
import com.fy.www.admin.pojo.Users;
|
||
|
import com.fy.www.admin.pojo.Usersrule;
|
||
|
import com.fy.www.admin.service.iface.IGroupService;
|
||
|
import com.fy.www.admin.service.iface.IMenuService;
|
||
|
import com.fy.www.admin.service.iface.ISysLogrecordService;
|
||
|
import com.fy.www.admin.service.iface.IUsersService;
|
||
|
import com.fy.www.admin.service.iface.IUsersruleService;
|
||
|
import com.fy.www.bdata.service.iface.IBdataService;
|
||
|
import com.fy.www.work.pojo.AccountBase;
|
||
|
import com.fy.www.work.pojo.LngLat;
|
||
|
import com.fy.www.work.pojo.OsBase;
|
||
|
import com.fy.www.work.pojo.SocialBase;
|
||
|
import com.fy.www.work.pojo.SocialExtend;
|
||
|
import com.fy.www.work.pojo.SysLog;
|
||
|
import com.fy.www.work.service.iface.IAccountBaseService;
|
||
|
import com.fy.www.work.service.iface.IOsBaseService;
|
||
|
import com.fy.www.work.service.iface.ISocialBaseService;
|
||
|
import com.fy.www.work.service.iface.ISocialExtendService;
|
||
|
import com.fy.www.work.service.iface.ISysLogService;
|
||
|
import com.obj8.net.core.Md5er;
|
||
|
import com.obj8.net.core.Timer;
|
||
|
|
||
|
/**
|
||
|
* @author obj8.li
|
||
|
* 核心跳转controller
|
||
|
* 可以统一进行添加通用方法
|
||
|
*/
|
||
|
@Controller
|
||
|
public class BaseController extends com.fy.core.BaseController {
|
||
|
|
||
|
@Resource(name="menuService")
|
||
|
private IMenuService menuService;
|
||
|
|
||
|
public void setMenuService(IMenuService menuService) {
|
||
|
this.menuService = menuService;
|
||
|
}
|
||
|
|
||
|
@Resource(name="usersService")
|
||
|
private IUsersService usersService;
|
||
|
|
||
|
public void setUsersService(IUsersService usersService) {
|
||
|
this.usersService = usersService;
|
||
|
}
|
||
|
|
||
|
@Resource(name="accountBaseService")
|
||
|
private IAccountBaseService accountBaseService;
|
||
|
|
||
|
public void setAccountBaseService(IAccountBaseService accountBaseService) {
|
||
|
this.accountBaseService = accountBaseService;
|
||
|
}
|
||
|
|
||
|
@Resource(name="bdataService")
|
||
|
private IBdataService bdataService;
|
||
|
|
||
|
public void setBdataService(IBdataService bdataService) {
|
||
|
this.bdataService = bdataService;
|
||
|
}
|
||
|
|
||
|
@Resource(name="sysLogrecordService")
|
||
|
private ISysLogrecordService sysLogrecordService;
|
||
|
|
||
|
public void ISysLogrecordService(ISysLogrecordService sysLogrecordService) {
|
||
|
this.sysLogrecordService = sysLogrecordService;
|
||
|
}
|
||
|
|
||
|
@Resource
|
||
|
private IOsBaseService osBaseService;
|
||
|
@Resource
|
||
|
private IUsersruleService usersruleService;
|
||
|
|
||
|
/**/
|
||
|
@Resource private ISocialBaseService socialBaseService;
|
||
|
|
||
|
@Resource private IGroupService groupService;
|
||
|
|
||
|
// @Resource private IOsBaseService osBaseService;
|
||
|
|
||
|
@Resource private ISocialExtendService socialExtendService;
|
||
|
|
||
|
|
||
|
// @Resource private IAccountBaseService accountBaseService;
|
||
|
/**
|
||
|
* 临时默认跳转
|
||
|
*/
|
||
|
@RequestMapping("/login")
|
||
|
public String login(HttpServletRequest request){
|
||
|
//返回系统参数设置
|
||
|
request.setAttribute("p", CacheHandler.rootMap);
|
||
|
//返回版本设置
|
||
|
request.setAttribute("v", CacheHandler.pcVersList);
|
||
|
return "login";
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 临时操作
|
||
|
* 跳转主界面方法
|
||
|
* @param t 标识
|
||
|
*/
|
||
|
@RequestMapping("/index_tmp/{t}")
|
||
|
public String indexTmp(@PathVariable String t, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
|
||
|
// if(session.getAttribute("manager_user") != null){
|
||
|
// //返回系统参数设置
|
||
|
// request.setAttribute("p", CacheHandler.rootMap);
|
||
|
// return "index";
|
||
|
// }else{
|
||
|
// return "redirect:/login";
|
||
|
// }
|
||
|
/**/
|
||
|
|
||
|
|
||
|
System.out.println("--->>>平台进入,创建session=manager_user");
|
||
|
System.out.println("--->>>平台跳转,路径:index.ftl");
|
||
|
System.out.println("------------------------------------------------------------------------------------------------");
|
||
|
|
||
|
//超级管理员
|
||
|
//String json = "{\"usersUid\":\"root\",\"status\":true,\"usersName\":\"超级管理员\"}";
|
||
|
//JSONObject jsonObj = JSONObject.parseObject(json);
|
||
|
//System.out.println("--->>>平台跳转,临时“超级管理员”登录");
|
||
|
//System.out.println("------------------------------------------------------------------------------------------------");
|
||
|
|
||
|
//临时登录成功json串 企业
|
||
|
/**/
|
||
|
String json = "{\"usersUid\":\"mzw\",\"groupCls\":\"44\",\"groupName\":\"民族大酒店\",\"status\":true,\"tel\":\"null\",\"regionVals\":\"新疆维吾尔自治区,吐鲁番,高昌区\",\"code\":\"9\",\"groupId\":\"1160BBDA07A94BB29BC7AEFD9CDC30CA\",\"regionIds\":\"650000,650400,650402\",\"usersName\":\"民族大酒店管理员\",\"email\":\"null\",\"regionVal\":\"高昌区\",\"regionId\":\"650402\"}";
|
||
|
JSONObject jsonObj = JSONObject.parseObject(json);
|
||
|
jsonObj.put("baseId", "5");//临时登录成功json串 企业
|
||
|
jsonObj.put("baseCls", "1");//临时登录成功json串 企业
|
||
|
jsonObj.put("usersRules", "1,2,3,4,5,6,0#0001,2359#0");
|
||
|
jsonObj.put("isThis", "1");
|
||
|
System.out.println("--->>>平台跳转,临时“企业”登录");
|
||
|
System.out.println("------------------------------------------------------------------------------------------------");
|
||
|
|
||
|
|
||
|
|
||
|
//监管 临时登录成功json串
|
||
|
/*大队
|
||
|
String json = "{\"usersUid\":\"tlfgcxfdd\",\"groupCls\":\"11\",\"groupName\":\"吐鲁番高昌消防大队\",\"status\":true,\"tel\":\"119\",\"regionVals\":\"新疆维吾尔自治区,吐鲁番,高昌区\",\"code\":\"9\",\"groupId\":\"CE35B6EF01AB4644909732F41863C74F\",\"regionIds\":\"650000,650400,650402\",\"usersName\":\"吐鲁番高昌消防大队管理员\",\"email\":\"110\",\"regionVal\":\"高昌区\",\"regionId\":\"650402\"}";
|
||
|
JSONObject jsonObj = JSONObject.parseObject(json);
|
||
|
jsonObj.put("baseId", "8");//临时登录成功json串 企业
|
||
|
jsonObj.put("baseCls", "0");//临时登录成功json串 监管
|
||
|
jsonObj.put("usersRules", "1,2,3,4,5,6#0830,2359#0");
|
||
|
jsonObj.put("isThis", "1");
|
||
|
System.out.println("--->>>平台跳转,临时“监管”登录");
|
||
|
System.out.println("------------------------------------------------------------------------------------------------");
|
||
|
*/
|
||
|
|
||
|
|
||
|
//监管 临时登录成功json串
|
||
|
/*支队
|
||
|
String json = "{\"usersUid\":\"a1\",\"groupCls\":\"11\",\"groupName\":\"吐鲁番消防支队\",\"status\":true,\"tel\":\"119\",\"regionVals\":\"新疆维吾尔自治区,吐鲁番\",\"code\":\"9\",\"groupId\":\"2198DC27B19A406DAFB6437399EC30B0\",\"regionIds\":\"650000,650400\",\"usersName\":\"吐鲁番消防支队管理\",\"email\":\"110\",\"regionVal\":\"吐鲁番\",\"regionId\":\"650400\"}";
|
||
|
JSONObject jsonObj = JSONObject.parseObject(json);
|
||
|
jsonObj.put("baseId", "5");//临时登录成功json串 企业
|
||
|
jsonObj.put("baseCls", "0");//临时登录成功json串 监管
|
||
|
jsonObj.put("usersRules", "1,2,3,4,5,6#0830,2359#0");
|
||
|
jsonObj.put("isThis", "1");
|
||
|
System.out.println("--->>>平台跳转,临时“监管”登录");
|
||
|
System.out.println("------------------------------------------------------------------------------------------------");
|
||
|
*/
|
||
|
|
||
|
|
||
|
//监管 临时登录成功json串
|
||
|
/*总队
|
||
|
String json = "{\"usersUid\":\"xjxfzd\",\"groupCls\":\"11\",\"groupName\":\"新疆消防总队\",\"status\":true,\"tel\":\"119\",\"regionVals\":\"新疆维吾尔自治区\",\"code\":\"9\",\"groupId\":\"CE35B6EF01AB4644909732F41863C74F\",\"regionIds\":\"650000\",\"usersName\":\"新疆消防总队管理员\",\"email\":\"110\",\"regionVal\":\"新疆维吾尔自治区\",\"regionId\":\"650000\"}";
|
||
|
JSONObject jsonObj = JSONObject.parseObject(json);
|
||
|
jsonObj.put("baseId", "8");//临时登录成功json串 企业
|
||
|
jsonObj.put("baseCls", "0");//临时登录成功json串 监管
|
||
|
jsonObj.put("usersRules", "1,2,3,4,5,6#0830,2359#0");
|
||
|
jsonObj.put("isThis", "1");
|
||
|
System.out.println("--->>>平台跳转,临时“监管”登录");
|
||
|
System.out.println("------------------------------------------------------------------------------------------------");
|
||
|
*/
|
||
|
|
||
|
|
||
|
|
||
|
//真正的session是这个
|
||
|
session.setAttribute("manager_user", jsonObj);
|
||
|
//临时封装
|
||
|
request.setAttribute("p", CacheHandler.rootMap);
|
||
|
|
||
|
if("admin".equals(t)){
|
||
|
//系统管理员,需要跳转管理界面
|
||
|
//超级管理员,全部的设置菜单
|
||
|
List _menuList = menuService.listMenu("-1", new String[0]);
|
||
|
//处理菜单数据
|
||
|
List<String[]> _menu2List = new ArrayList<String[]>();//主菜单数据
|
||
|
List<String[]> _menu3List = new ArrayList<String[]>();
|
||
|
for (int i = 0; i < _menuList.size(); i++) {
|
||
|
Menu _menu = (Menu) _menuList.get(i);
|
||
|
String[] _menuArr = new String[]{_menu.getId(), _menu.getMenuPid(), _menu.getMenuTitle(), _menu.getMenuUrl()};
|
||
|
if("2".equals(_menu.getMenuLevel())){
|
||
|
_menu2List.add(_menuArr);
|
||
|
}
|
||
|
if("3".equals(_menu.getMenuLevel())){
|
||
|
_menu3List.add(_menuArr);;
|
||
|
}
|
||
|
}
|
||
|
//处理level=3的菜单数据
|
||
|
Map<String, List<String[]>> _map = new HashMap<String, List<String[]>>();//二级菜单数据
|
||
|
List<String[]> _tmpList = null;
|
||
|
for (int i = 0; i < _menu2List.size(); i++) {
|
||
|
String[] arr2 = _menu2List.get(i);
|
||
|
_tmpList = new ArrayList<String[]>();
|
||
|
for (int j = 0; j < _menu3List.size(); j++) {
|
||
|
String[] arr3 = _menu3List.get(j);
|
||
|
if(arr3[1].equals(arr2[0])){
|
||
|
_tmpList.add(arr3);
|
||
|
}
|
||
|
}
|
||
|
_map.put(arr2[0], _tmpList);
|
||
|
}
|
||
|
request.setAttribute("menuList", _menu2List);
|
||
|
request.setAttribute("menuMap", _map);
|
||
|
return "admin/index";
|
||
|
}else{
|
||
|
return "work/index";
|
||
|
}
|
||
|
|
||
|
//临时登录成功json串 企业
|
||
|
//String json = "{\"usersUid\":\"altstyg\",\"groupCls\":\"44\",\"groupName\":\"阿勒泰市体育馆\",\"status\":true,\"tel\":\"null\",\"regionVals\":\"中国,新疆维吾尔自治区,阿勒泰地区,阿勒泰市\",\"code\":\"9\",\"groupId\":\"4CB485AEDB324796804397D7F7BA301C\",\"regionIds\":\"650000,654300,653101\",\"usersName\":\"阿勒泰市体育馆管理员\",\"email\":\"null\",\"regionVal\":\"阿勒泰市\",\"regionId\":\"654301\"}";
|
||
|
|
||
|
/**/
|
||
|
//监管 临时登录成功json串
|
||
|
//String json = "{\"usersUid\":\"c1\",\"groupCls\":\"11\",\"groupName\":\"阿勒泰消防大队\",\"status\":true,\"tel\":\"119\",\"regionVals\":\"中国,新疆维吾尔自治区,阿勒泰地区,阿勒泰市\",\"code\":\"9\",\"groupId\":\"061E38ED253E4D93B150A588E3C5186F\",\"regionIds\":\"650000,654300,654301\",\"usersName\":\"曹队长\",\"email\":\"110\",\"regionVal\":\"阿勒泰市\",\"regionId\":\"654301\"}";
|
||
|
|
||
|
//JSONObject jsonObj = JSONObject.parseObject(json);
|
||
|
//临时登录成功json串 企业
|
||
|
//jsonObj.put("socId", "1");
|
||
|
|
||
|
//临时封装超级管理员的
|
||
|
//session.setAttribute("manager_user_tmp", new String[]{jsonObj.getString("usersUid"), jsonObj.getString("usersName"), jsonObj.getString("groupName")});
|
||
|
|
||
|
//临时存储登录信息
|
||
|
//this.bulidCookie("fy_root_c", JSON.toJSONString(json), response);
|
||
|
// return "";
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//===========================================================================================================================
|
||
|
//正式跳转方法
|
||
|
/**
|
||
|
* 跳转主界面方法
|
||
|
* @param t 标识
|
||
|
*/
|
||
|
@RequestMapping("/index/{t}")
|
||
|
public String index(@PathVariable String t, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
|
||
|
if(session.getAttribute("manager_user") == null){
|
||
|
return "redirect:/login";
|
||
|
}
|
||
|
|
||
|
|
||
|
//返回系统参数设置
|
||
|
request.setAttribute("p", CacheHandler.rootMap);
|
||
|
if("admin".equals(t)){
|
||
|
//系统管理员,需要跳转管理界面
|
||
|
Map sessMap = (Map) session.getAttribute("manager_user");
|
||
|
List _menuList = (List) sessMap.get("admin");
|
||
|
//List _menuList = menuService.listMenu("-1", new String[0]);
|
||
|
//处理菜单数据
|
||
|
List<String[]> _menu2List = new ArrayList<String[]>();//主菜单数据
|
||
|
List<String[]> _menu3List = new ArrayList<String[]>();
|
||
|
for (int i = 0; i < _menuList.size(); i++) {
|
||
|
Map _map = (Map) _menuList.get(i);
|
||
|
String[] _menuArr = new String[]{String.valueOf(_map.get("id")), String.valueOf(_map.get("menuPid")), String.valueOf(_map.get("menuTitle")), String.valueOf(_map.get("menuUrl"))};
|
||
|
if("2".equals(String.valueOf(_map.get("menuLevel")))){
|
||
|
_menu2List.add(_menuArr);
|
||
|
}
|
||
|
if("3".equals(String.valueOf(_map.get("menuLevel")))){
|
||
|
_menu3List.add(_menuArr);
|
||
|
}
|
||
|
}
|
||
|
//处理level=3的菜单数据
|
||
|
Map<String, List<String[]>> _map = new HashMap<String, List<String[]>>();//二级菜单数据
|
||
|
List<String[]> _tmpList = null;
|
||
|
for (int i = 0; i < _menu2List.size(); i++) {
|
||
|
String[] arr2 = _menu2List.get(i);
|
||
|
_tmpList = new ArrayList<String[]>();
|
||
|
for (int j = 0; j < _menu3List.size(); j++) {
|
||
|
String[] arr3 = _menu3List.get(j);
|
||
|
if(arr3[1].equals(arr2[0])){
|
||
|
_tmpList.add(arr3);
|
||
|
}
|
||
|
}
|
||
|
_map.put(arr2[0], _tmpList);
|
||
|
}
|
||
|
// List<String[]> _menu2List = new ArrayList<String[]>();//主菜单数据
|
||
|
// List<String[]> _menu3List = new ArrayList<String[]>();
|
||
|
// for (int i = 0; i < _menuList.size(); i++) {
|
||
|
// Menu _menu = (Menu) _menuList.get(i);
|
||
|
// String[] _menuArr = new String[]{_menu.getId(), _menu.getMenuPid(), _menu.getMenuTitle(), _menu.getMenuUrl()};
|
||
|
// if("2".equals(_menu.getMenuLevel())){
|
||
|
// _menu2List.add(_menuArr);
|
||
|
// }
|
||
|
// if("3".equals(_menu.getMenuLevel())){
|
||
|
// _menu3List.add(_menuArr);;
|
||
|
// }
|
||
|
// }
|
||
|
// //处理level=3的菜单数据
|
||
|
// Map<String, List<String[]>> _map = new HashMap<String, List<String[]>>();//二级菜单数据
|
||
|
// List<String[]> _tmpList = null;
|
||
|
// for (int i = 0; i < _menu2List.size(); i++) {
|
||
|
// String[] arr2 = _menu2List.get(i);
|
||
|
// _tmpList = new ArrayList<String[]>();
|
||
|
// for (int j = 0; j < _menu3List.size(); j++) {
|
||
|
// String[] arr3 = _menu3List.get(j);
|
||
|
// if(arr3[1].equals(arr2[0])){
|
||
|
// _tmpList.add(arr3);
|
||
|
// }
|
||
|
// }
|
||
|
// _map.put(arr2[0], _tmpList);
|
||
|
// }
|
||
|
request.setAttribute("menuList", _menu2List);
|
||
|
request.setAttribute("menuMap", _map);
|
||
|
return "admin/index";
|
||
|
}else{
|
||
|
//正常工作跳转,将来需要串调菜单数据
|
||
|
Map sessMap = (Map) session.getAttribute("manager_user");
|
||
|
//System.out.println(String.valueOf(session.getAttribute("manager_user")));
|
||
|
//System.out.println(sessMap.get("menus"));
|
||
|
//System.out.println(sessMap.get("baseId"));
|
||
|
String _str = (String) sessMap.get("baseCls");
|
||
|
// SysLog log = new SysLog();
|
||
|
// log.setLogIp(this.getIpAddr(request));
|
||
|
// log.setLogTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||
|
// log.setUsersUid((String) sessMap.get("usersUid"));
|
||
|
// sysLogService.insertSysLog(log);
|
||
|
if("1".equals(sessMap.get("isThis"))) {
|
||
|
List _menuList = (List) sessMap.get("admin");
|
||
|
//List _menuList = menuService.listMenu("-1", new String[0]);
|
||
|
//处理菜单数据
|
||
|
List<String[]> _menu2List = new ArrayList<String[]>();//主菜单数据
|
||
|
List<String[]> _menu3List = new ArrayList<String[]>();
|
||
|
for (int i = 0; i < _menuList.size(); i++) {
|
||
|
Map _map = (Map) _menuList.get(i);
|
||
|
String[] _menuArr = new String[]{String.valueOf(_map.get("id")), String.valueOf(_map.get("menuPid")), String.valueOf(_map.get("menuTitle")), String.valueOf(_map.get("menuUrl"))};
|
||
|
if("2".equals(String.valueOf(_map.get("menuLevel")))){
|
||
|
_menu2List.add(_menuArr);
|
||
|
}
|
||
|
if("3".equals(String.valueOf(_map.get("menuLevel")))){
|
||
|
_menu3List.add(_menuArr);
|
||
|
}
|
||
|
}
|
||
|
//处理level=3的菜单数据
|
||
|
Map<String, List<String[]>> _map = new HashMap<String, List<String[]>>();//二级菜单数据
|
||
|
List<String[]> _tmpList = null;
|
||
|
for (int i = 0; i < _menu2List.size(); i++) {
|
||
|
String[] arr2 = _menu2List.get(i);
|
||
|
_tmpList = new ArrayList<String[]>();
|
||
|
for (int j = 0; j < _menu3List.size(); j++) {
|
||
|
String[] arr3 = _menu3List.get(j);
|
||
|
if(arr3[1].equals(arr2[0])){
|
||
|
_tmpList.add(arr3);
|
||
|
}
|
||
|
}
|
||
|
_map.put(arr2[0], _tmpList);
|
||
|
}
|
||
|
request.setAttribute("menuList", _menu2List);
|
||
|
request.setAttribute("menuMap", _map);
|
||
|
return "admin/index";
|
||
|
}
|
||
|
if("0".equals(_str)){
|
||
|
return "work/index";
|
||
|
}else{
|
||
|
return "work/index1";
|
||
|
}
|
||
|
//return "work/index1";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 加载社会单位首页数据
|
||
|
*/
|
||
|
@RequestMapping("/index/main1")
|
||
|
public String data1Index(HttpServletRequest request){
|
||
|
//返回系统参数设置
|
||
|
// request.setAttribute("p", CacheHandler.rootMap);
|
||
|
// //返回版本设置
|
||
|
request.setAttribute("v", CacheHandler.pcVersList);
|
||
|
return "work/index_main1";
|
||
|
}
|
||
|
|
||
|
/**物联跳转
|
||
|
* @param request
|
||
|
* @return
|
||
|
*/
|
||
|
@RequestMapping("/rms")
|
||
|
public String rms(HttpServletRequest request){
|
||
|
//返回系统参数设置
|
||
|
return "work/rms";
|
||
|
}
|
||
|
/**
|
||
|
* 社会单位消防管理
|
||
|
*/
|
||
|
@RequestMapping("/work1/madin")
|
||
|
public String madinWork1(HttpServletRequest request){
|
||
|
//返回系统参数设置
|
||
|
// request.setAttribute("p", CacheHandler.rootMap);
|
||
|
// //返回版本设置
|
||
|
// request.setAttribute("v", CacheHandler.pcVersList);
|
||
|
return "work/work_main_1";
|
||
|
}
|
||
|
|
||
|
@ResponseBody
|
||
|
@RequestMapping("/signin")
|
||
|
public String signin(String usersUid, String usersPwd, HttpSession session, HttpServletRequest request, HttpServletResponse response){
|
||
|
Map signinMap = new HashMap();
|
||
|
signinMap.put("usersUid", usersUid);
|
||
|
signinMap.put("usersPwd", Md5er.showMd5(usersPwd));
|
||
|
signinMap.put("type", "pc");
|
||
|
signinMap.put("code", new String());
|
||
|
signinMap.put("msg", new String());
|
||
|
signinMap.put("rs_users", new ArrayList<Map<String, Object>>());
|
||
|
signinMap.put("rs_admin", new ArrayList<Map<String, Object>>());
|
||
|
signinMap.put("menus", new String());
|
||
|
usersService.call4signin(signinMap);
|
||
|
String code = String.valueOf(signinMap.get("code"));
|
||
|
if("0".equals(code)){
|
||
|
//登录失败的
|
||
|
jsonMap = new HashMap();
|
||
|
jsonMap.put("msg", String.valueOf(signinMap.get("msg")));
|
||
|
return this.writeJson(jsonMap, false);
|
||
|
}else{
|
||
|
Map<String, Object> sessMap = (Map<String, Object>)((List)signinMap.get("rs_users")).get(0);
|
||
|
sessMap.put("admin", (List) signinMap.get("rs_admin"));
|
||
|
//sessMap.put("menus", String.valueOf(signinMap.get("menus")));
|
||
|
//封装session
|
||
|
session.setAttribute("manager_user", sessMap);
|
||
|
session.setMaxInactiveInterval(8*24*60*60);
|
||
|
//存储登录信息
|
||
|
Map cookieMap = new HashMap();
|
||
|
cookieMap.put("usersUid", sessMap.get("usersUid"));
|
||
|
cookieMap.put("usersName", sessMap.get("usersName"));
|
||
|
cookieMap.put("groupId", sessMap.get("groupId"));
|
||
|
cookieMap.put("groupName", sessMap.get("groupName"));
|
||
|
cookieMap.put("regionId", sessMap.get("regionId"));
|
||
|
cookieMap.put("regionIds", sessMap.get("regionIds"));
|
||
|
cookieMap.put("regionVal", sessMap.get("regionVal"));
|
||
|
cookieMap.put("regionVals", sessMap.get("regionVals"));
|
||
|
cookieMap.put("baseId", sessMap.get("baseId"));
|
||
|
cookieMap.put("baseCls", sessMap.get("baseCls"));
|
||
|
//存储组织树的信息
|
||
|
cookieMap.put("orgId", sessMap.get("orgId")==null?"":sessMap.get("orgId"));
|
||
|
cookieMap.put("orgName", sessMap.get("orgName")==null?"":sessMap.get("orgName"));
|
||
|
cookieMap.put("orgType", sessMap.get("orgType")==null?"":sessMap.get("orgType"));
|
||
|
cookieMap.put("orgLevel", sessMap.get("orgLevel")==null?"":sessMap.get("orgLevel"));
|
||
|
cookieMap.put("deadline", sessMap.get("deadline")==null?"":sessMap.get("deadline"));
|
||
|
cookieMap.put("reset", sessMap.get("reset")==null?"":sessMap.get("reset"));
|
||
|
cookieMap.put("operateGate", sessMap.get("operateGate")==null?"":sessMap.get("operateGate"));
|
||
|
this.bulidCookie("fy_root_c", JSON.toJSONString(cookieMap), response);
|
||
|
this.appendLog(String.valueOf(sessMap.get("usersUid")), request);
|
||
|
//跳转
|
||
|
jsonMap = new HashMap();
|
||
|
jsonMap.put("code", code);
|
||
|
return this.writeJson(jsonMap, true);
|
||
|
}
|
||
|
|
||
|
//System.out.println(usersUid+"============"+usersPwd);
|
||
|
//String signinJson = DataHandler.signinWsData(usersUid, Md5er.showMd5(usersPwd));
|
||
|
// jsonMap = new HashMap();
|
||
|
// List usersList = usersService.listUsers4signin(usersUid, Md5er.showMd5(usersPwd));
|
||
|
// if(usersList != null && usersList.size() > 0){
|
||
|
// Users users = (Users) usersList.get(0);
|
||
|
// if("root".equals(users.getUsersUid())){
|
||
|
// jsonMap.put("code", "-1");//仅代表root登录成功
|
||
|
// jsonMap.put("usersUid", users.getUsersUid());
|
||
|
// jsonMap.put("usersName", users.getUsersName());
|
||
|
// jsonMap.put("isThis", users.getIsThis());
|
||
|
// session.setAttribute("manager_user", jsonMap);
|
||
|
// session.setMaxInactiveInterval(8*24*60*60);
|
||
|
// return this.writeJson(jsonMap, true);
|
||
|
// }
|
||
|
// //解析rules =1,2,4,5,6,0#0001,2359#1
|
||
|
// String _state = users.getUsersState();
|
||
|
// if("0".equals(_state)){
|
||
|
// //状态正常的账户
|
||
|
// //分析星期
|
||
|
// Date thisDate = new Date();//获取当前时间
|
||
|
// Calendar cal = Calendar.getInstance();//利用日历类
|
||
|
// cal.setTime(thisDate);
|
||
|
// //获取当前星期几
|
||
|
// String _week = users.getUsersWeek();
|
||
|
// String week = String.valueOf(cal.get(Calendar.DAY_OF_WEEK) - 1);//今天星期几
|
||
|
// if(_week.indexOf(week) > -1){
|
||
|
// //今天能登录//判断登录时间
|
||
|
// String _time = users.getUsersTime();
|
||
|
// //获取当前时间
|
||
|
// int time = Integer.parseInt(String.valueOf(cal.get(Calendar.HOUR_OF_DAY)) + (String.valueOf(cal.get(Calendar.MINUTE)).length()==1?"0"+cal.get(Calendar.MINUTE):cal.get(Calendar.MINUTE)) );
|
||
|
// //分割usersTime
|
||
|
// int s = Integer.parseInt(_time.substring(0, 4));
|
||
|
// int e = Integer.parseInt(_time.substring(5));
|
||
|
// if(time > s && time < e){
|
||
|
// //当前时间点可以登录
|
||
|
// //验证完毕,登录
|
||
|
// jsonMap.put("code", "9");//仅代表登录成功
|
||
|
// jsonMap.put("usersUid", users.getUsersUid());
|
||
|
// jsonMap.put("usersName", users.getUsersName());
|
||
|
// jsonMap.put("regionId", users.getRegionId());
|
||
|
// jsonMap.put("regionIds", users.getRegionIds());
|
||
|
// jsonMap.put("regionVal", users.getRegionVal());
|
||
|
// jsonMap.put("regionVals", users.getRegionVals());
|
||
|
// jsonMap.put("tel", users.getTel());
|
||
|
// jsonMap.put("email", users.getEmail());
|
||
|
// jsonMap.put("groupId", users.getGroupId());
|
||
|
// jsonMap.put("groupIdc", users.getGroupIdc());
|
||
|
// jsonMap.put("groupName", users.getGroupName());
|
||
|
// jsonMap.put("relId", users.getGroupId());
|
||
|
// jsonMap.put("baseId", users.getBaseId());
|
||
|
// jsonMap.put("baseCls", users.getBaseCls());
|
||
|
// jsonMap.put("usersRules", users.getUsersRules());
|
||
|
// jsonMap.put("isThis", users.getIsThis());
|
||
|
// /*此地预留group_exp的解析*/
|
||
|
//// jsonMap.put("industryId", "");//行业id
|
||
|
//// jsonMap.put("industryIds", "");//行业ids
|
||
|
//// jsonMap.put("industryVal", "");//行业名字
|
||
|
//// jsonMap.put("industryVals", "");//行业名字串联
|
||
|
// //真正的session是这个
|
||
|
// session.setAttribute("manager_user", jsonMap);
|
||
|
// session.setMaxInactiveInterval(8*24*60*60);
|
||
|
// //存储登录信息
|
||
|
// this.bulidCookie("fy_root_c", JSON.toJSONString(jsonMap), response);
|
||
|
// //跳转
|
||
|
// return this.writeJson(true);
|
||
|
// }else{
|
||
|
// //当前时间点不能登录
|
||
|
// jsonMap.put("code", "3");
|
||
|
// jsonMap.put("msg", "登录失败,登录账号权限不足。");
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// //当前星期几不能登录
|
||
|
// jsonMap.put("code", "2");
|
||
|
// jsonMap.put("msg", "登录失败,登录账号权限不足。");
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// //状态异常账户
|
||
|
// jsonMap.put("code", "1");
|
||
|
// jsonMap.put("msg", "登录失败,登录账号已被锁定。");
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// jsonMap.put("code", "0");
|
||
|
// jsonMap.put("msg", "登录失败,登录账号或者登录密码错误。");
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
}
|
||
|
// -----营区登陆----- 消防部署请屏蔽 ---------------- 2020.10.26 why
|
||
|
@RequestMapping("/signinCamp")
|
||
|
public String signinCamp(String usersUid, String cityCode,HttpSession session, HttpServletRequest request, HttpServletResponse response){
|
||
|
Map signinMap = new HashMap();
|
||
|
signinMap.put("usersUid", usersUid);
|
||
|
signinMap.put("type", "pc");
|
||
|
signinMap.put("code", new String());
|
||
|
signinMap.put("msg", new String());
|
||
|
signinMap.put("rs_users", new ArrayList<Map<String, Object>>());
|
||
|
signinMap.put("rs_admin", new ArrayList<Map<String, Object>>());
|
||
|
signinMap.put("menus", new String());
|
||
|
usersService.call4signinCamp(signinMap);
|
||
|
String code = String.valueOf(signinMap.get("code"));
|
||
|
if("0".equals(code)){
|
||
|
//登录失败的
|
||
|
// jsonMap = new HashMap();
|
||
|
// jsonMap.put("msg", String.valueOf(signinMap.get("msg")));
|
||
|
signinMap.put("usersUid", cityCode);
|
||
|
if("0".equals(code)) {
|
||
|
usersService.call4signinCampCode(signinMap);
|
||
|
Map<String, Object> sessMap = (Map<String, Object>)((List)signinMap.get("rs_users")).get(0);
|
||
|
sessMap.put("admin", (List) signinMap.get("rs_admin"));
|
||
|
//sessMap.put("menus", String.valueOf(signinMap.get("menus")));
|
||
|
//封装session
|
||
|
session.setAttribute("manager_user", sessMap);
|
||
|
session.setMaxInactiveInterval(8*24*60*60);
|
||
|
//存储登录信息
|
||
|
Map cookieMap = new HashMap();
|
||
|
cookieMap.put("usersUid", sessMap.get("usersUid"));
|
||
|
cookieMap.put("usersName", sessMap.get("usersName"));
|
||
|
cookieMap.put("groupId", sessMap.get("groupId"));
|
||
|
cookieMap.put("groupName", sessMap.get("groupName"));
|
||
|
cookieMap.put("regionId", sessMap.get("regionId"));
|
||
|
cookieMap.put("regionIds", sessMap.get("regionIds"));
|
||
|
cookieMap.put("regionVal", sessMap.get("regionVal"));
|
||
|
cookieMap.put("regionVals", sessMap.get("regionVals"));
|
||
|
cookieMap.put("baseId", sessMap.get("baseId"));
|
||
|
cookieMap.put("baseCls", sessMap.get("baseCls"));
|
||
|
//存储组织树的信息
|
||
|
cookieMap.put("orgId", sessMap.get("orgId")==null?"":sessMap.get("orgId"));
|
||
|
cookieMap.put("orgName", sessMap.get("orgName")==null?"":sessMap.get("orgName"));
|
||
|
cookieMap.put("orgType", sessMap.get("orgType")==null?"":sessMap.get("orgType"));
|
||
|
cookieMap.put("orgLevel", sessMap.get("orgLevel")==null?"":sessMap.get("orgLevel"));
|
||
|
cookieMap.put("deadline", sessMap.get("deadline")==null?"":sessMap.get("deadline"));
|
||
|
cookieMap.put("reset", sessMap.get("reset")==null?"":sessMap.get("reset"));
|
||
|
cookieMap.put("operateGate", sessMap.get("operateGate")==null?"":sessMap.get("operateGate"));
|
||
|
this.bulidCookie("fy_root_c", JSON.toJSONString(cookieMap), response);
|
||
|
this.appendLog(String.valueOf(sessMap.get("usersUid")), request);
|
||
|
//跳转
|
||
|
if("0".equals(sessMap.get("baseCls"))){
|
||
|
code = "99";
|
||
|
}
|
||
|
//跳转
|
||
|
jsonMap = new HashMap();
|
||
|
jsonMap.put("code", code);
|
||
|
}
|
||
|
|
||
|
return "work/indexyq";
|
||
|
}else{
|
||
|
Map<String, Object> sessMap = (Map<String, Object>)((List)signinMap.get("rs_users")).get(0);
|
||
|
sessMap.put("admin", (List) signinMap.get("rs_admin"));
|
||
|
//sessMap.put("menus", String.valueOf(signinMap.get("menus")));
|
||
|
//封装session
|
||
|
session.setAttribute("manager_user", sessMap);
|
||
|
session.setMaxInactiveInterval(8*24*60*60);
|
||
|
//存储登录信息
|
||
|
Map cookieMap = new HashMap();
|
||
|
cookieMap.put("usersUid", sessMap.get("usersUid"));
|
||
|
cookieMap.put("usersName", sessMap.get("usersName"));
|
||
|
cookieMap.put("groupId", sessMap.get("groupId"));
|
||
|
cookieMap.put("groupName", sessMap.get("groupName"));
|
||
|
cookieMap.put("regionId", sessMap.get("regionId"));
|
||
|
cookieMap.put("regionIds", sessMap.get("regionIds"));
|
||
|
cookieMap.put("regionVal", sessMap.get("regionVal"));
|
||
|
cookieMap.put("regionVals", sessMap.get("regionVals"));
|
||
|
cookieMap.put("baseId", sessMap.get("baseId"));
|
||
|
cookieMap.put("baseCls", sessMap.get("baseCls"));
|
||
|
//存储组织树的信息
|
||
|
cookieMap.put("orgId", sessMap.get("orgId")==null?"":sessMap.get("orgId"));
|
||
|
cookieMap.put("orgName", sessMap.get("orgName")==null?"":sessMap.get("orgName"));
|
||
|
cookieMap.put("orgType", sessMap.get("orgType")==null?"":sessMap.get("orgType"));
|
||
|
cookieMap.put("orgLevel", sessMap.get("orgLevel")==null?"":sessMap.get("orgLevel"));
|
||
|
cookieMap.put("deadline", sessMap.get("deadline")==null?"":sessMap.get("deadline"));
|
||
|
cookieMap.put("reset", sessMap.get("reset")==null?"":sessMap.get("reset"));
|
||
|
cookieMap.put("operateGate", sessMap.get("operateGate")==null?"":sessMap.get("operateGate"));
|
||
|
this.bulidCookie("fy_root_c", JSON.toJSONString(cookieMap), response);
|
||
|
this.appendLog(String.valueOf(sessMap.get("usersUid")), request);
|
||
|
//跳转
|
||
|
if("0".equals(sessMap.get("baseCls"))){
|
||
|
code = "99";
|
||
|
}
|
||
|
//跳转
|
||
|
jsonMap = new HashMap();
|
||
|
jsonMap.put("code", code);
|
||
|
return "work/indexyq";
|
||
|
}
|
||
|
}
|
||
|
@RequestMapping("/unsignin")
|
||
|
public String unsignin(HttpSession session){
|
||
|
if(session.getAttribute("manager_user") != null){
|
||
|
session.removeAttribute("manager_user");
|
||
|
}
|
||
|
//return "redirect:/def";
|
||
|
return "redirect:/login";
|
||
|
}
|
||
|
|
||
|
// @RequestMapping("/home")
|
||
|
// public String home(HttpServletRequest request){
|
||
|
// return "home";
|
||
|
// }
|
||
|
|
||
|
@ResponseBody
|
||
|
@RequestMapping("/pwd")
|
||
|
public String pwd(String usersPwd, HttpSession session){
|
||
|
String usersUid = "";
|
||
|
if(session.getAttribute("manager_user") != null){
|
||
|
usersUid = (String) ((Map)session.getAttribute("manager_user")).get("usersUid");
|
||
|
}
|
||
|
Users users = new Users();
|
||
|
users.setUsersUid(usersUid);
|
||
|
users.setUsersPwd(Md5er.showMd5(usersPwd));
|
||
|
usersService.updateUsers(users);
|
||
|
return this.writeJson(true);
|
||
|
}
|
||
|
|
||
|
@ResponseBody
|
||
|
@RequestMapping("/own/{t}")
|
||
|
public String own(@PathVariable String t, String usersUid, String usersName, String tel, String email){
|
||
|
if("0".equals(t)){
|
||
|
Users users = usersService.getUsers4own(usersUid);
|
||
|
return this.writeJson(users);
|
||
|
}else{
|
||
|
Users users = new Users();
|
||
|
users.setUsersUid(usersUid);
|
||
|
users.setUsersName(usersName);
|
||
|
users.setTel(tel);
|
||
|
users.setEmail(email);
|
||
|
usersService.updateUsers(users);
|
||
|
accountBaseService.updateAccountBase4own(usersUid, usersName, tel, email);
|
||
|
return this.writeJson(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//=====================================================================================================================
|
||
|
//后台home==============================================================================================================
|
||
|
@RequestMapping("/admin/home")
|
||
|
public String home(){
|
||
|
return "admin/home";
|
||
|
}
|
||
|
|
||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||
|
//------------------------------------------------------------------------------------------------------------------------------
|
||
|
private void bulidCookie(String n, String val, HttpServletResponse response){
|
||
|
try {
|
||
|
Cookie c = new Cookie(n, URLEncoder.encode(val, "UTF-8"));
|
||
|
c.setPath("/");
|
||
|
c.setMaxAge(8*24*60*60);//设置其生命周期 8小时
|
||
|
//c.setDomain(".firecloud119.com");
|
||
|
response.addCookie(c);
|
||
|
} catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void appendLog(String usersUid, HttpServletRequest request){
|
||
|
SysLogrecord sysLogrecord = new SysLogrecord();
|
||
|
sysLogrecord.setLogIp(super.getIpAddr(request));
|
||
|
sysLogrecord.setLogUseruid(usersUid);
|
||
|
sysLogrecord.setLogTime(Timer.renNowStringTime("yyyy-MM-dd HH:mm:ss"));
|
||
|
// System.out.println(super.getIpAddr(sysLogrecord.getLogIp()));
|
||
|
// sysLogrecord.setLogAddr(super.getIpAddr(sysLogrecord.getLogIp()));
|
||
|
sysLogrecord.setLogOperation("login");
|
||
|
sysLogrecord.setLogContent("系统登陆成功");
|
||
|
sysLogrecord.setLogType("100");
|
||
|
sysLogrecord.setLogTypename(String.valueOf(CacheHandler.logTypeMap.get("100")));
|
||
|
sysLogrecordService.insertSysLogrecord(sysLogrecord);
|
||
|
}
|
||
|
|
||
|
@ResponseBody
|
||
|
@RequestMapping("/rmsAppendLog")
|
||
|
public String rmsAppendLog(String usersUid, String ip, String ipAddr, String logMethod, String logContent, String logType){
|
||
|
SysLogrecord sysLogrecord = new SysLogrecord();
|
||
|
sysLogrecord.setLogIp(ip);
|
||
|
sysLogrecord.setLogUseruid(usersUid);
|
||
|
sysLogrecord.setLogTime(Timer.renNowStringTime("yyyy-MM-dd HH:mm:ss"));
|
||
|
sysLogrecord.setLogAddr(ipAddr);
|
||
|
sysLogrecord.setLogOperation(logMethod);
|
||
|
sysLogrecord.setLogContent(logContent);
|
||
|
sysLogrecord.setLogType(logType);
|
||
|
sysLogrecord.setLogTypename(String.valueOf(CacheHandler.logTypeMap.get(logType)));
|
||
|
sysLogrecordService.insertSysLogrecord(sysLogrecord);
|
||
|
return this.writeJson(true);
|
||
|
}
|
||
|
|
||
|
|
||
|
// @RequestMapping("/login")
|
||
|
// public String login(HttpServletRequest request){
|
||
|
// //返回系统参数设置
|
||
|
// request.setAttribute("root_title", CacheHandler.rootMap.get("title"));
|
||
|
// request.setAttribute("root_version", CacheHandler.rootMap.get("version"));
|
||
|
// request.setAttribute("root_copyright", CacheHandler.rootMap.get("copyright"));
|
||
|
// request.setAttribute("root_vcode", CacheHandler.rootMap.get("vcode"));
|
||
|
// request.setAttribute("root_vcoden", CacheHandler.rootMap.get("vcoden"));
|
||
|
// return "login";
|
||
|
// }
|
||
|
//
|
||
|
// @ResponseBody
|
||
|
// @RequestMapping("/signin")
|
||
|
// public String signin(String usersUid, String usersPwd, String vcode, HttpServletRequest request, HttpSession session){
|
||
|
// jsonMap = new HashMap();
|
||
|
// if(vcode != null && vcode.length() > 0){//有验证码
|
||
|
// String _vcode = String.valueOf(session.getAttribute("verifyCode"));
|
||
|
// if(_vcode.equals(vcode)){
|
||
|
// //验证码正确
|
||
|
// List usersList = (List)usersService.listUsers(usersUid, Md5er.showMd5(usersPwd), true);
|
||
|
// if(usersList != null && usersList.size() > 0){
|
||
|
// //账户密码正确
|
||
|
// Users _users = (Users) usersList.get(0);
|
||
|
// if("1".equals(_users.getIsdel())){
|
||
|
// jsonMap.put("code", "3");//账户删除状态
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }else{
|
||
|
// if("-1".equals(_users.getUsersRules())){
|
||
|
// //超级管理员 无需解析了
|
||
|
// //登录成功,封装session
|
||
|
// session.setAttribute("irms_user", new String[]{_users.getUsersUid(), _users.getUsersName(), "-1"});
|
||
|
// session.setMaxInactiveInterval(8*24*60*60);
|
||
|
// //记录登录日志
|
||
|
// Log log = new Log();
|
||
|
// log.setAppId("-1");
|
||
|
// log.setLogTime(new Date());
|
||
|
// log.setLogType("1");
|
||
|
// log.setLogIp(this.getIpAddr(request));
|
||
|
// log.setLogHost(request.getRemoteHost());
|
||
|
// CacheHandler.logList.add(log);//入缓存
|
||
|
// }else{
|
||
|
// if("1".equals(_users.getUsersState())){
|
||
|
// //账户锁定
|
||
|
// jsonMap.put("code", "4");//账户锁定状态
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }else{
|
||
|
// //判断日期
|
||
|
// Date thisDate = new Date();//获取当前时间
|
||
|
// Calendar cal = Calendar.getInstance();//利用日历类
|
||
|
// cal.setTime(thisDate);
|
||
|
// //获取当前星期几
|
||
|
// String week = String.valueOf(cal.get(Calendar.DAY_OF_WEEK) - 1);//今天星期几
|
||
|
// if(_users.getUsersWeek().indexOf(week) > -1){
|
||
|
// //今天能登录
|
||
|
// //判断登录时间
|
||
|
// //获取当前时间
|
||
|
// int time = Integer.parseInt(String.valueOf(cal.get(Calendar.HOUR_OF_DAY)) + (String.valueOf(cal.get(Calendar.MINUTE)).length()==1?"0"+cal.get(Calendar.MINUTE):cal.get(Calendar.MINUTE)) );
|
||
|
// //分割usersTime
|
||
|
// int s = Integer.parseInt(_users.getUsersTime().substring(0, 4));
|
||
|
// int e = Integer.parseInt(_users.getUsersTime().substring(5));
|
||
|
// if(time >= s && time <= e){
|
||
|
// //当前时间点可以登录
|
||
|
// //登录成功,封装session
|
||
|
// session.setAttribute("irms_user", new String[]{_users.getUsersUid(), _users.getUsersName(), "0"});
|
||
|
// session.setMaxInactiveInterval(8*24*60*60);
|
||
|
// //记录登录日志
|
||
|
// Log log = new Log();
|
||
|
// log.setUsersInfo(_users.getUsersUid() + "," + _users.getUsersName());
|
||
|
// log.setAppId("-1");
|
||
|
// log.setLogTime(thisDate);
|
||
|
// log.setLogType("1");
|
||
|
// log.setLogIp(this.getIpAddr(request));
|
||
|
// log.setLogHost(request.getRemoteHost());
|
||
|
// CacheHandler.logList.add(log);//入缓存
|
||
|
// }else{
|
||
|
// jsonMap.put("code", 6);//当前时间点不能登录
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// jsonMap.put("code", "5");//当前星期几不能登录
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// }else{
|
||
|
// jsonMap.put("code", "2");//账户密码不正确
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// jsonMap.put("code", "1");//验证码不正确
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// //无验证码
|
||
|
// //直接判断登录
|
||
|
// List usersList = (List)usersService.listUsers(usersUid, Md5er.showMd5(usersPwd), true);
|
||
|
// if(usersList != null && usersList.size() > 0){
|
||
|
// //账户密码正确
|
||
|
// Users _users = (Users) usersList.get(0);
|
||
|
// if("1".equals(_users.getIsdel())){
|
||
|
// jsonMap.put("code", "3");//账户删除状态
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }else{
|
||
|
// //解析rules
|
||
|
// if("-1".equals(_users.getUsersRules())){
|
||
|
// //超级管理员 无需解析了
|
||
|
// //登录成功,封装session
|
||
|
// session.setAttribute("irms_user", new String[]{_users.getUsersUid(), _users.getUsersName(), "-1"});
|
||
|
// session.setMaxInactiveInterval(8*24*60*60);
|
||
|
// //记录登录日志
|
||
|
// Log log = new Log();
|
||
|
// log.setUsersInfo(_users.getUsersUid() + "," + _users.getUsersName());
|
||
|
// log.setAppId("-1");
|
||
|
// log.setLogTime(new Date());
|
||
|
// log.setLogType("1");
|
||
|
// log.setLogIp(this.getIpAddr(request));
|
||
|
// log.setLogHost(request.getRemoteHost());
|
||
|
// CacheHandler.logList.add(log);//入缓存
|
||
|
// }else{
|
||
|
// if("1".equals(_users.getUsersState())){
|
||
|
// //账户锁定
|
||
|
// jsonMap.put("code", "4");//账户锁定状态
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }else{
|
||
|
// //判断日期
|
||
|
// Date thisDate = new Date();//获取当前时间
|
||
|
// Calendar cal = Calendar.getInstance();//利用日历类
|
||
|
// cal.setTime(thisDate);
|
||
|
// //获取当前星期几
|
||
|
// String week = String.valueOf(cal.get(Calendar.DAY_OF_WEEK) - 1);//今天星期几
|
||
|
// if(_users.getUsersWeek().indexOf(week) > -1){
|
||
|
// //今天能登录
|
||
|
// //判断登录时间
|
||
|
// //获取当前时间
|
||
|
// int time = Integer.parseInt(String.valueOf(cal.get(Calendar.HOUR_OF_DAY)) + (String.valueOf(cal.get(Calendar.MINUTE)).length()==1?"0"+cal.get(Calendar.MINUTE):cal.get(Calendar.MINUTE)) );
|
||
|
// //分割usersTime
|
||
|
// int s = Integer.parseInt(_users.getUsersTime().substring(0, 4));
|
||
|
// int e = Integer.parseInt(_users.getUsersTime().substring(5));
|
||
|
// if(time >= s && time <= e){
|
||
|
// //当前时间点可以登录
|
||
|
// //登录成功,封装session
|
||
|
// session.setAttribute("irms_user", new String[]{_users.getUsersUid(), _users.getUsersName(), "0"});
|
||
|
// session.setMaxInactiveInterval(8*24*60*60);
|
||
|
// //记录登录日志
|
||
|
// Log log = new Log();
|
||
|
// log.setAppId("-1");
|
||
|
// log.setLogTime(thisDate);
|
||
|
// log.setLogType("1");
|
||
|
// log.setLogIp(this.getIpAddr(request));
|
||
|
// log.setLogHost(request.getRemoteHost());
|
||
|
// CacheHandler.logList.add(log);//入缓存
|
||
|
// }else{
|
||
|
// jsonMap.put("code", 6);//当前时间点不能登录
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }else{
|
||
|
// jsonMap.put("code", "5");//当前星期几不能登录
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// }
|
||
|
// }else{
|
||
|
// jsonMap.put("code", "2");//账户密码不正确
|
||
|
// return this.writeJson(jsonMap, false);
|
||
|
// }
|
||
|
// }
|
||
|
// return this.writeJson(true);
|
||
|
// }
|
||
|
//
|
||
|
// @RequestMapping("/index")
|
||
|
// public String index(HttpServletRequest request, HttpSession session){
|
||
|
// //默认封装session,session.setAttribute("irms_user", new String[]{"root", "超级管理员", "-1"});
|
||
|
// if(session.getAttribute("irms_user") != null){
|
||
|
// String[] sessionArr = (String[]) session.getAttribute("irms_user");
|
||
|
//
|
||
|
//
|
||
|
// if("0".equals(sessionArr[2])){
|
||
|
// //普通用户,读取菜单权限,匹配菜单数据
|
||
|
// Usersrule usersrule = new Usersrule();
|
||
|
// usersrule.setAppId("-1");
|
||
|
// usersrule.setUsersUid(sessionArr[0]);
|
||
|
// List usersruleList = usersruleService.listUsersrule(usersrule);
|
||
|
// if(usersruleList != null && usersruleList.size() > 0){
|
||
|
// String haveMenus = ((Usersrule)usersruleList.get(0)).getMenuVals();
|
||
|
// String[] _mentVals = haveMenus.split("###");
|
||
|
// List _menuList = menuService.listMenu(new String[0]);
|
||
|
// //处理菜单数据
|
||
|
// List<String[]> _menu2List = new ArrayList<String[]>();//主菜单数据
|
||
|
// List<String[]> _menu3List = new ArrayList<String[]>();
|
||
|
// for (int i = 0; i < _menuList.size(); i++) {
|
||
|
// Menu _menu = (Menu) _menuList.get(i);
|
||
|
// String[] _menuArr = new String[]{_menu.getId(), _menu.getMenuPid(), _menu.getMenuTitle(), _menu.getMenuUrl()};
|
||
|
// if("2".equals(_menu.getMenuLevel()) && _mentVals[1].indexOf(_menu.getId()) > -1){
|
||
|
// _menu2List.add(_menuArr);
|
||
|
// }
|
||
|
// if("3".equals(_menu.getMenuLevel()) && _mentVals[0].indexOf(_menu.getId()) > -1){
|
||
|
// _menu3List.add(_menuArr);;
|
||
|
// }
|
||
|
// }
|
||
|
// //处理level=3的菜单数据
|
||
|
// Map<String, List<String[]>> _map = new HashMap<String, List<String[]>>();//二级菜单数据
|
||
|
// List<String[]> _tmpList = null;
|
||
|
// for (int i = 0; i < _menu2List.size(); i++) {
|
||
|
// String[] arr2 = _menu2List.get(i);
|
||
|
// _tmpList = new ArrayList<String[]>();
|
||
|
// for (int j = 0; j < _menu3List.size(); j++) {
|
||
|
// String[] arr3 = _menu3List.get(j);
|
||
|
// if(arr3[1].equals(arr2[0])){
|
||
|
// _tmpList.add(arr3);
|
||
|
// }
|
||
|
// }
|
||
|
// _map.put(arr2[0], _tmpList);
|
||
|
// }
|
||
|
// request.setAttribute("menuList", _menu2List);
|
||
|
// request.setAttribute("menuMap", _map);
|
||
|
// }else{
|
||
|
// request.setAttribute("menuList", null);
|
||
|
// }
|
||
|
// }else{
|
||
|
// //超级管理员,全部菜单
|
||
|
// List _menuList = menuService.listMenu(new String[0]);
|
||
|
// //处理菜单数据
|
||
|
// List<String[]> _menu2List = new ArrayList<String[]>();//主菜单数据
|
||
|
// List<String[]> _menu3List = new ArrayList<String[]>();
|
||
|
// for (int i = 0; i < _menuList.size(); i++) {
|
||
|
// Menu _menu = (Menu) _menuList.get(i);
|
||
|
// String[] _menuArr = new String[]{_menu.getId(), _menu.getMenuPid(), _menu.getMenuTitle(), _menu.getMenuUrl()};
|
||
|
// if("2".equals(_menu.getMenuLevel())){
|
||
|
// _menu2List.add(_menuArr);
|
||
|
// }
|
||
|
// if("3".equals(_menu.getMenuLevel())){
|
||
|
// _menu3List.add(_menuArr);;
|
||
|
// }
|
||
|
// }
|
||
|
// //处理level=3的菜单数据
|
||
|
// Map<String, List<String[]>> _map = new HashMap<String, List<String[]>>();//二级菜单数据
|
||
|
// List<String[]> _tmpList = null;
|
||
|
// for (int i = 0; i < _menu2List.size(); i++) {
|
||
|
// String[] arr2 = _menu2List.get(i);
|
||
|
// _tmpList = new ArrayList<String[]>();
|
||
|
// for (int j = 0; j < _menu3List.size(); j++) {
|
||
|
// String[] arr3 = _menu3List.get(j);
|
||
|
// if(arr3[1].equals(arr2[0])){
|
||
|
// _tmpList.add(arr3);
|
||
|
// }
|
||
|
// }
|
||
|
// _map.put(arr2[0], _tmpList);
|
||
|
// }
|
||
|
// request.setAttribute("menuList", _menu2List);
|
||
|
// request.setAttribute("menuMap", _map);
|
||
|
// }
|
||
|
// //返回系统参数设置
|
||
|
// request.setAttribute("root_title", CacheHandler.rootMap.get("title"));
|
||
|
// request.setAttribute("root_version", CacheHandler.rootMap.get("version"));
|
||
|
// request.setAttribute("root_copyright", CacheHandler.rootMap.get("copyright"));
|
||
|
// return "index";
|
||
|
// }else{
|
||
|
// return "redirect:/login";
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
//// @RequestMapping("/menu")
|
||
|
//// public String menu(String pid, HttpServletRequest request, HttpSession session){
|
||
|
//// //System.out.println(pid);//M09
|
||
|
//// //定义1级和2级菜单
|
||
|
//// List _level2 = new ArrayList();
|
||
|
//// Map _level3 = new HashMap();
|
||
|
//// //获取session
|
||
|
//// SessVo sv = (SessVo) session.getAttribute("admins_user");
|
||
|
//// if("-1".equals(sv.getUsersRules()[0])){
|
||
|
//// //超级管理员全部菜单
|
||
|
//// //获取1级和2级菜单
|
||
|
//// //通过平台菜单获取1级和2级菜单json
|
||
|
//// String sql = "select t.id, t.pid, t.menu_title, t.menu_titleen, t.menu_titleru, t.menu_url, t.menu_level "
|
||
|
//// + "from tbl_base_menu t start with t.pid = '"+pid+"' and t.menu_flag = '0' connect by prior t.id = t.pid "
|
||
|
//// + "order by id asc";
|
||
|
//// List _menuList = commonService.execSql4List(sql, true, true);//执行
|
||
|
//// String _mapKey = "";//定义map的临时_mapKey
|
||
|
//// List _mapList = null;//定义存储map集合的临时_mapList
|
||
|
//// for (int j = 0; j < _menuList.size(); j++) {
|
||
|
//// Map _m = (Map) _menuList.get(j);
|
||
|
//// if("2".equals(_m.get("menuLevel"))){//如果是2level(1级菜单)存储_mapKey,并将1级菜单信息存储到map中
|
||
|
//// _level2.add(_m);
|
||
|
//// if(_mapKey != ""){
|
||
|
//// _level3.put(_mapKey, _mapList);
|
||
|
//// }
|
||
|
//// _mapKey = String.valueOf(_m.get("id"));
|
||
|
//// _mapList = new ArrayList();
|
||
|
//// continue;
|
||
|
//// }
|
||
|
//// _mapList.add(_m);
|
||
|
//// }
|
||
|
//// //最后还需要处理与预存储的_mapKey(因为最后一次循环结束之后应该还有_mapKey的赋值)
|
||
|
//// if(_mapKey != ""){
|
||
|
//// _level3.put(_mapKey, _mapList);
|
||
|
//// }
|
||
|
//// }else if("-9".equals(sv.getUsersRules()[0])){
|
||
|
//// //刚注册临时用户
|
||
|
//// //获取临时菜单id
|
||
|
//// String[] ids = sv.getUsersRules()[1].split(",");
|
||
|
//// String id = "'";
|
||
|
//// for (int i = 0; i < ids.length - 1; i++) {
|
||
|
//// id += ids[i] + "', '";
|
||
|
//// }
|
||
|
//// id += ids[ids.length - 1] + "'";
|
||
|
//// String sql = "select id, pid, menu_title, menu_titleen, menu_titleru, menu_url, menu_level "
|
||
|
//// + "from tbl_base_menu start with "
|
||
|
//// + "pid = '"+pid+"' "
|
||
|
//// + "and menu_flag = '0' "
|
||
|
//// + "and id in (select distinct ttt.pid from tbl_base_menu ttt where ttt.id in ("+id+")) "
|
||
|
//// + "connect by prior id = pid "
|
||
|
//// + "order by id asc";
|
||
|
//// List _menuListTmp = commonService.execSql4List(sql, true, true);//执行
|
||
|
//// List<Map<String, String>> _menuList = new ArrayList<Map<String, String>>();
|
||
|
//// for (int i = 0; i < _menuListTmp.size(); i++) {
|
||
|
//// Map<String, String> _menuMap = (Map<String, String>) _menuListTmp.get(i);
|
||
|
//// if("2".equals(_menuMap.get("menuLevel"))){
|
||
|
//// _menuList.add(_menuMap);
|
||
|
//// continue;
|
||
|
//// }
|
||
|
//// if(id.indexOf(_menuMap.get("id")) > -1){
|
||
|
//// _menuList.add(_menuMap);
|
||
|
//// }
|
||
|
//// }
|
||
|
//// String _mapKey = "";//定义map的临时_mapKey
|
||
|
//// List _mapList = null;//定义存储map集合的临时_mapList
|
||
|
//// for (int j = 0; j < _menuList.size(); j++) {
|
||
|
//// Map _m = (Map) _menuList.get(j);
|
||
|
//// if("2".equals(_m.get("menuLevel"))){//如果是2level(1级菜单)存储_mapKey,并将1级菜单信息存储到map中
|
||
|
//// _level2.add(_m);
|
||
|
//// if(_mapKey != ""){
|
||
|
//// _level3.put(_mapKey, _mapList);
|
||
|
//// }
|
||
|
//// _mapKey = String.valueOf(_m.get("id"));
|
||
|
//// _mapList = new ArrayList();
|
||
|
//// continue;
|
||
|
//// }
|
||
|
//// _mapList.add(_m);
|
||
|
//// }
|
||
|
//// //最后还需要处理与预存储的_mapKey(因为最后一次循环结束之后应该还有_mapKey的赋值)
|
||
|
//// if(_mapKey != ""){
|
||
|
//// _level3.put(_mapKey, _mapList);
|
||
|
//// }
|
||
|
//// }else{
|
||
|
//// //普通登录用户
|
||
|
//// String[] ids = sv.getMenus().split(",");
|
||
|
//// String id = "'";
|
||
|
//// for (int i = 0; i < ids.length - 1; i++) {
|
||
|
//// id += ids[i] + "', '";
|
||
|
//// }
|
||
|
//// id += ids[ids.length - 1] + "'";
|
||
|
//// String sql = "select id, pid, menu_title, menu_titleen, menu_titleru, menu_url, menu_level "
|
||
|
//// + "from tbl_base_menu start with "
|
||
|
//// + "pid = '"+pid+"' "
|
||
|
//// + "and menu_flag = '0' "
|
||
|
//// + "and id in (select distinct ttt.pid from tbl_base_menu ttt where ttt.id in ("+id+")) "
|
||
|
//// + "connect by prior id = pid "
|
||
|
//// + "order by id asc";
|
||
|
//// List _menuListTmp = commonService.execSql4List(sql, true, true);//执行
|
||
|
//// List<Map<String, String>> _menuList = new ArrayList<Map<String, String>>();
|
||
|
//// for (int i = 0; i < _menuListTmp.size(); i++) {
|
||
|
//// Map<String, String> _menuMap = (Map<String, String>) _menuListTmp.get(i);
|
||
|
//// if("2".equals(_menuMap.get("menuLevel"))){
|
||
|
//// _menuList.add(_menuMap);
|
||
|
//// continue;
|
||
|
//// }
|
||
|
//// if(id.indexOf(_menuMap.get("id")) > -1){
|
||
|
//// _menuList.add(_menuMap);
|
||
|
//// }
|
||
|
//// }
|
||
|
//// String _mapKey = "";//定义map的临时_mapKey
|
||
|
//// List _mapList = null;//定义存储map集合的临时_mapList
|
||
|
//// for (int j = 0; j < _menuList.size(); j++) {
|
||
|
//// Map _m = (Map) _menuList.get(j);
|
||
|
//// if("2".equals(_m.get("menuLevel"))){//如果是2level(1级菜单)存储_mapKey,并将1级菜单信息存储到map中
|
||
|
//// _level2.add(_m);
|
||
|
//// if(_mapKey != ""){
|
||
|
//// _level3.put(_mapKey, _mapList);
|
||
|
//// }
|
||
|
//// _mapKey = String.valueOf(_m.get("id"));
|
||
|
//// _mapList = new ArrayList();
|
||
|
//// continue;
|
||
|
//// }
|
||
|
//// _mapList.add(_m);
|
||
|
//// }
|
||
|
//// //最后还需要处理与预存储的_mapKey(因为最后一次循环结束之后应该还有_mapKey的赋值)
|
||
|
//// if(_mapKey != ""){
|
||
|
//// _level3.put(_mapKey, _mapList);
|
||
|
//// }
|
||
|
//// }
|
||
|
//// request.setAttribute("lang", sv.getLanguage());
|
||
|
//// request.setAttribute("ctx", request.getContextPath());
|
||
|
//// request.setAttribute("level2_menu", _level2);
|
||
|
//// request.setAttribute("level3_menu", _level3);
|
||
|
//// return "ftl/admins/menu";
|
||
|
//// }
|
||
|
//
|
||
|
// @RequestMapping("/home")
|
||
|
// public String home(HttpServletRequest request, HttpSession session){
|
||
|
// jsonMap = new HashMap();
|
||
|
// //1 先展示登录时间, 上次登录时间
|
||
|
// String sql1 = "select t.log_time from (select log_time, rownum rn from tbl_log where log_type = '1' and users_info like 'root,%' order by log_time desc) t where t.rn < 3";
|
||
|
// List sql1List = commonService.execSql4List(sql1, true, true);
|
||
|
// jsonMap.put("loginData", sql1List);
|
||
|
// //2 管理多少个应用系统
|
||
|
// String sql2 = "select t.app_cls, count(0) as cc from tbl_app t where t.app_state = '0' group by t.app_cls order by app_cls asc";
|
||
|
// List sql2List = commonService.execSql4List(sql2, true, true);
|
||
|
// jsonMap.put("appsData", sql2List);
|
||
|
// //3 管理多少个接口程序 接口总调用次数 每个接口的总条用次数
|
||
|
// String sql3 = "select t1.*, t2.* from "
|
||
|
// + "(select t.ws_method as wsm1, count(0) as cc1 from tbl_wses t group by t.ws_method) t1 "
|
||
|
// + "left join "
|
||
|
// + "(select t.ws_method as wsm2, count(0) as cc2 from tbl_wses t where trunc(t.ws_time) = trunc(sysdate) group by t.ws_method ) t2 "
|
||
|
// + "on t2.wsm2 = t1.wsm1 "
|
||
|
// + "order by t1.cc1 desc";
|
||
|
// List sql3List = commonService.execSql4List(sql3, true, true);
|
||
|
// jsonMap.put("wsData", sql3List);
|
||
|
// //4 版本介绍
|
||
|
// jsonMap.put("desData", CacheHandler.rootMap.get("des"));
|
||
|
// request.setAttribute("homeData", jsonMap);
|
||
|
// //获取接口辅助
|
||
|
// try {
|
||
|
// //读取接口配置文件,并形成json串
|
||
|
// Map<String,String> wsMap = new HashMap<String, String>();
|
||
|
// String wsPath = session.getServletContext().getRealPath("/WEB-INF/pros");
|
||
|
// Properties pros = new Properties();
|
||
|
// InputStream in = new FileInputStream(wsPath + "/ws.properties");
|
||
|
// pros.load(in);
|
||
|
// Set<Object> keys = pros.keySet();
|
||
|
// for (Object k : keys) {
|
||
|
// wsMap.put(String.valueOf(k), pros.getProperty(String.valueOf(k)));
|
||
|
// }
|
||
|
// in.close();
|
||
|
// //转换为json
|
||
|
// request.setAttribute("wsJson", JSON.toJSONString(wsMap, SerializerFeature.UseSingleQuotes));
|
||
|
// } catch (Exception e) {
|
||
|
// e.printStackTrace();
|
||
|
// }
|
||
|
///*
|
||
|
//1 先展示登录时间, 上次登录时间n
|
||
|
//select t.log_time from
|
||
|
//(select log_time, rownum rn from tbl_log where log_type = '2' and users_info like 'root,%') t where t.rn < 3
|
||
|
//
|
||
|
//
|
||
|
//
|
||
|
// 2 多少个功能菜单和功能点
|
||
|
//select t.MENU_LEVEL, count(0) as cc from sys_menu t where t.app_id = '-1' group by t.MENU_LEVEL order by cc asc
|
||
|
//
|
||
|
// 3 管理多少个应用系统
|
||
|
//select t.app_cls, count(0) as cc from tbl_app t where t.app_state = '0' group by t.app_cls order by cc asc
|
||
|
//
|
||
|
// 4 管理多少个接口程序 接口总调用次数 每个接口的总条用次数
|
||
|
// 今天总调用 每个接口今天的调用
|
||
|
//select t1.*, t2.* from
|
||
|
//(
|
||
|
//select t.ws_method as wsm, count(0) as cc
|
||
|
//from tbl_wses t
|
||
|
//group by t.ws_method
|
||
|
//) t1
|
||
|
//left join
|
||
|
//(
|
||
|
//select t.ws_method as wsm, count(0) as cc
|
||
|
//from tbl_wses t where trunc(t.ws_time) = trunc(sysdate)
|
||
|
//group by t.ws_method
|
||
|
//) t2 on t2.wsm = t1.wsm order by t1.cc desc
|
||
|
//
|
||
|
// 5版本介绍 */
|
||
|
// return "home";
|
||
|
// }
|
||
|
//
|
||
|
// @ResponseBody
|
||
|
// @RequestMapping("/own/{t}")
|
||
|
// public String own(@PathVariable String t, String usersUid, String usersName, String tel, String email){
|
||
|
// if("1".equals(t)){
|
||
|
// usersService.getUsers(usersUid, usersName, tel, email);
|
||
|
// return this.writeJson(true);
|
||
|
// }else{
|
||
|
// Users users = usersService.getUsers(usersUid, null, null, null);
|
||
|
// return this.writeJson(users);
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
// @ResponseBody
|
||
|
// @RequestMapping("/pwd")
|
||
|
// public String pwd(String usersUid, String usersPwd){
|
||
|
// Users users = new Users();
|
||
|
// users.setUsersUid(usersUid);
|
||
|
// users.setUsersPwd(Md5er.showMd5(usersPwd));
|
||
|
// usersService.updateUsers(users);
|
||
|
// return this.writeJson(true);
|
||
|
// }
|
||
|
//
|
||
|
// @RequestMapping("/signout")
|
||
|
// public String signout(HttpSession session){
|
||
|
// if(session.getAttribute("irms_user") != null){
|
||
|
// session.removeAttribute("irms_user");
|
||
|
// }
|
||
|
// return "redirect:/login";
|
||
|
// }
|
||
|
//
|
||
|
//// @ResponseBody
|
||
|
//// @RequestMapping("/baseInfo/{t}")
|
||
|
//// public String baseInfo(@PathVariable("t") String t, String orgName, String usersUid, String usersPwd, String usersName) {
|
||
|
//// if("0".equals(t)){//判断是否有管理员
|
||
|
//// UsersMember usersMember = new UsersMember();
|
||
|
//// usersMember.setMemType("a");//获取管理用户会员类型数据
|
||
|
//// List usersMemberList = usersMemberService.listUsersMember(usersMember);
|
||
|
//// if(usersMemberList != null && usersMemberList.size() > 0){
|
||
|
//// return this.writeJson(false);
|
||
|
//// }else{
|
||
|
//// return this.writeJson(true);
|
||
|
//// }
|
||
|
//// }else{//前台添加功能
|
||
|
//// UsersBase usersBase = new UsersBase();
|
||
|
//// usersBase.setUsersUid(usersUid);
|
||
|
//// List usersBaseList = usersBaseService.listUsersBase(usersBase);
|
||
|
//// if(usersBaseList != null && usersBaseList.size() > 0){
|
||
|
//// return this.writeJson(false);
|
||
|
//// }else{
|
||
|
//// //添加用户基本信息
|
||
|
//// usersBase.setUsersPwd(usersPwd==null?Md5er.showMd5("123"):Md5er.showMd5(usersPwd));
|
||
|
//// usersBase.setUsersRule("-1");
|
||
|
//// usersBase.setUsersState("0");
|
||
|
//// usersBaseService.insertUsersBase(usersBase);
|
||
|
//// //添加用户会员信息
|
||
|
//// UsersMember usersMember = new UsersMember();
|
||
|
//// usersMember.setUsersId(usersBase.getId());
|
||
|
//// usersMember.setUsersUid(usersUid);
|
||
|
//// usersMember.setUsersName(usersName);
|
||
|
//// usersMember.setUsersType("2");
|
||
|
//// usersMember.setMemType("a");
|
||
|
//// usersMember.setMemStatus("9");
|
||
|
//// usersMember.setBiid("100000");
|
||
|
//// usersMemberService.insertUsersMember(usersMember);
|
||
|
//// return this.writeJson(true);
|
||
|
//// }
|
||
|
//// }
|
||
|
//// }
|
||
|
//
|
||
|
// @RequestMapping("/vcode")
|
||
|
// public void verifyCode(HttpServletRequest request, HttpServletResponse response) throws IOException{
|
||
|
// int vcoden = Integer.parseInt(String.valueOf(CacheHandler.rootMap.get("vcoden")));
|
||
|
// int _w = 64;
|
||
|
// if(vcoden == 5) _w = 74;
|
||
|
// if(vcoden == 6) _w = 88;
|
||
|
// HttpSession session = request.getSession();
|
||
|
// response.setContentType("image/gif");
|
||
|
// response.setHeader("Pragma", "No-cache");
|
||
|
// response.setHeader("Cache-Control", "no-cache");
|
||
|
// response.setDateHeader("Expires", 0L);
|
||
|
// ServletOutputStream out = response.getOutputStream();
|
||
|
// BufferedImage image = new BufferedImage(_w, 36, 1);
|
||
|
// Graphics gra = image.getGraphics();
|
||
|
// Random random = new Random();
|
||
|
// gra.setColor(getRandColor(200, 250));
|
||
|
// gra.fillRect(0, 0, _w, 36);
|
||
|
// gra.setColor(Color.black);
|
||
|
// gra.setFont(new Font("Times New Roman", 0, 26));
|
||
|
// gra.setColor(getRandColor(160, 200));
|
||
|
// for (int i = 0; i < 155; i++){
|
||
|
// int x = random.nextInt(60);
|
||
|
// int y = random.nextInt(20);
|
||
|
// int xl = random.nextInt(12);
|
||
|
// int yl = random.nextInt(12);
|
||
|
// gra.drawLine(x, y, x + xl, y + yl);
|
||
|
// }
|
||
|
// String sRand = "";
|
||
|
// for (int i = 0; i < vcoden; i++){
|
||
|
// String rand = String.valueOf(random.nextInt(10));
|
||
|
// sRand = sRand + rand;
|
||
|
// gra.setColor(new Color(20 + random.nextInt(110), 20 + random.nextInt(110), 20 + random.nextInt(110)));
|
||
|
// gra.drawString(rand, 13 * i + 6, 26);
|
||
|
// }
|
||
|
// if(session.getAttribute("verifyCode") != null){
|
||
|
// session.removeAttribute("verifyCode");
|
||
|
// }
|
||
|
// session.setAttribute("verifyCode", sRand);
|
||
|
// //System.out.println(sRand);
|
||
|
// JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
|
||
|
// encoder.encode(image);
|
||
|
// out.flush();
|
||
|
// out.close();
|
||
|
// }
|
||
|
//
|
||
|
// private Color getRandColor(int fc, int bc){
|
||
|
// Random random = new Random();
|
||
|
// if (fc > 255)
|
||
|
// fc = 255;
|
||
|
// if (bc > 255)
|
||
|
// bc = 255;
|
||
|
// int r = fc + random.nextInt(bc - fc);
|
||
|
// int g = fc + random.nextInt(bc - fc);
|
||
|
// int b = fc + random.nextInt(bc - fc);
|
||
|
// return new Color(r, g, b);
|
||
|
// }
|
||
|
|
||
|
|
||
|
|
||
|
//2019.11.13社会单位首页 txh 右下角
|
||
|
@ResponseBody
|
||
|
@RequestMapping("/index1/getData")
|
||
|
public String getData(String baseId){
|
||
|
jsonMap = new HashMap();
|
||
|
Map _paramsMap = new HashMap();
|
||
|
_paramsMap.put("baseId", baseId);
|
||
|
_paramsMap.put("rsDueNum", new String());
|
||
|
_paramsMap.put("rsTotalNum", new String());
|
||
|
_paramsMap.put("rsYcz", new String());
|
||
|
_paramsMap.put("rsCzz", new String());
|
||
|
_paramsMap.put("rsWcz", new String());
|
||
|
_paramsMap.put("rsSocLoc", new String());
|
||
|
_paramsMap.put("rsData1", new ArrayList<Map<String, Object>>());
|
||
|
_paramsMap.put("rsData2", new ArrayList<Map<String, Object>>());
|
||
|
bdataService.callProcedure(_paramsMap, "Index1GetData");
|
||
|
jsonMap.put("dueNum", _paramsMap.get("rsDueNum"));
|
||
|
jsonMap.put("totalNum", _paramsMap.get("rsTotalNum"));
|
||
|
jsonMap.put("ycz", _paramsMap.get("rsYcz"));
|
||
|
jsonMap.put("czz", _paramsMap.get("rsCzz"));
|
||
|
jsonMap.put("wcz", _paramsMap.get("rsWcz"));
|
||
|
jsonMap.put("socLoc", _paramsMap.get("rsSocLoc"));
|
||
|
jsonMap.put("rsData1", _paramsMap.get("rsData1"));
|
||
|
jsonMap.put("rsData2", _paramsMap.get("rsData2"));
|
||
|
|
||
|
return this.writeJson(jsonMap);
|
||
|
}
|
||
|
//2019.11.13社会单位首页 txh 右下角
|
||
|
// @ResponseBody
|
||
|
// @RequestMapping("/map")
|
||
|
// public String getmap(String baseId){
|
||
|
// System.out.println("开始-----------------------------------------");
|
||
|
// List list = socialBaseService.listSocialBase4loc();
|
||
|
// System.out.println("-----------------------------------------");
|
||
|
// String _str = "";
|
||
|
// int k = 0;
|
||
|
// for(int i = 0; i< list.size(); i++) {
|
||
|
// SocialBase socialBase = (SocialBase) list.get(i);
|
||
|
// try {
|
||
|
// String[] str= socialBase.getSocLoc().split(",");
|
||
|
// LngLat lngLat_bd = new LngLat(Double.valueOf(str[0]),Double.valueOf(str[1]));
|
||
|
// socialBase.setSocLoc(CoodinateCovertor.bd_decrypt(lngLat_bd).toString());
|
||
|
// socialBaseService.updateSocialBase(socialBase);
|
||
|
// k++;
|
||
|
// } catch (Exception e) {
|
||
|
// _str += socialBase.getId() + ",";
|
||
|
// System.out.println(e);
|
||
|
// }
|
||
|
//
|
||
|
// }
|
||
|
// System.out.println(k + "-----------------------------------------");
|
||
|
// System.out.println(_str);
|
||
|
// return this.writeJson(true);
|
||
|
// }
|
||
|
|
||
|
@ResponseBody
|
||
|
@RequestMapping("/test")
|
||
|
public String test(HttpServletRequest request){
|
||
|
// String s = readJsonFile(request.getSession().getServletContext().getRealPath("/_files/_s/1.json"));
|
||
|
String s = readJsonFile(request.getSession().getServletContext().getRealPath("/_files/_s/2.json"));
|
||
|
JSONObject jobj = JSON.parseObject(s);
|
||
|
JSONArray movies = jobj.getJSONArray("RECORDS");//构建JSONArray数组
|
||
|
|
||
|
|
||
|
|
||
|
String _no = "";
|
||
|
|
||
|
|
||
|
for (int i = 0 ; i < movies.size();i++){
|
||
|
JSONObject key = (JSONObject)movies.get(i);
|
||
|
String USERS_UID = (String)key.get("USERS_UID");
|
||
|
String REGION_ID = (String)key.get("REGION_ID");
|
||
|
String REGION_IDS = (String)key.get("REGION_IDS");
|
||
|
String REGION_VAL = (String)key.get("REGION_VAL");
|
||
|
String REGION_VALS = (String)key.get("REGION_VALS");
|
||
|
AccountBase _accountBase = new AccountBase();
|
||
|
_accountBase.setAccountUid(USERS_UID);
|
||
|
List accountBaseList = accountBaseService.listAccountBase(_accountBase);
|
||
|
if (accountBaseList != null && accountBaseList.size() > 0) {
|
||
|
_no += ":" + USERS_UID;
|
||
|
}
|
||
|
AccountBase accountBase = new AccountBase();
|
||
|
accountBase.setAccountName((String)key.get("USERS_NAME"));
|
||
|
accountBase.setAccountUid(USERS_UID);
|
||
|
accountBase.setDeptId(-1);
|
||
|
accountBase.setBaseCls("1");
|
||
|
accountBase.setAdm("0");
|
||
|
accountBase.setIsdel("0");
|
||
|
|
||
|
|
||
|
OsBase osBase = new OsBase();
|
||
|
osBase.setRelId((String)key.get("GROUP_ID"));
|
||
|
List osBaseList = osBaseService.listOsBase(osBase);
|
||
|
OsBase _osBase = (OsBase)osBaseList.get(0);
|
||
|
accountBase.setBaseId(_osBase.getId());
|
||
|
// 先账号辅助表
|
||
|
accountBaseService.insertAccountBase(accountBase);
|
||
|
// sys_users表
|
||
|
Users users = new Users();
|
||
|
users.setUsersUid(USERS_UID);
|
||
|
users.setUsersPwd((String)key.get("USERS_PWD"));
|
||
|
users.setUsersName((String)key.get("USERS_NAME"));
|
||
|
users.setPusersUid((String)key.get("PUSERS_UID"));
|
||
|
users.setGroupId((String)key.get("GROUP_ID"));
|
||
|
users.setUsersRules((String)key.get("USERS_RULES"));
|
||
|
users.setIsThis("0");
|
||
|
users.setIsCls("0");
|
||
|
users.setRegionId(REGION_ID);
|
||
|
users.setRegionIds(REGION_IDS);
|
||
|
users.setRegionVal(REGION_VAL);
|
||
|
users.setRegionVals(REGION_VALS);
|
||
|
users.setIsdel("0");
|
||
|
usersService.insertUsers(users);
|
||
|
// sys_usersrule表
|
||
|
Usersrule usersrule = new Usersrule();
|
||
|
usersrule.setAppId("iffclouds");
|
||
|
usersrule.setUsersUid(accountBase.getAccountUid());
|
||
|
usersrule.setRuleId("6CEF3DB5BDE447F6BB737F957AA16A5D");
|
||
|
usersruleService.insertUsersrule(usersrule);
|
||
|
usersrule.setAppId("iffcloudsapp");
|
||
|
usersrule.setUsersUid(accountBase.getAccountUid());
|
||
|
usersrule.setRuleId("A19785F3A07F499EA9C2132BD4271DC8");
|
||
|
usersruleService.insertUsersrule(usersrule);
|
||
|
|
||
|
System.out.println(i);
|
||
|
}
|
||
|
System.out.println(_no);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/* 导入单位
|
||
|
for (int i = 0 ; i < movies.size();i++){
|
||
|
JSONObject key = (JSONObject)movies.get(i);
|
||
|
String name1 = (String)key.get("SOC_NAME");
|
||
|
String REGION_ID = (String)key.get("REGION_ID");
|
||
|
String REGION_IDS = (String)key.get("REGION_IDS");
|
||
|
String REGION_VAL = (String)key.get("REGION_VAL");
|
||
|
String REGION_VALS = (String)key.get("REGION_VALS");
|
||
|
String SOC_PHONES = (String)key.get("SOC_PHONES");
|
||
|
// if("658000".equals(REGION_IDS.split(",")[1])) {
|
||
|
// REGION_ID = "";
|
||
|
// REGION_IDS = "";
|
||
|
// REGION_VAL = "";
|
||
|
// REGION_VALS = "";
|
||
|
// }
|
||
|
Group group = new Group();
|
||
|
group.setId((String)key.get("ID"));
|
||
|
group.setGl(1);
|
||
|
group.setDl(1);
|
||
|
group.setPid("0");
|
||
|
group.setGroupName((String)key.get("SOC_NAME"));
|
||
|
group.setIsdel("0");
|
||
|
group.setRegionId(REGION_ID);
|
||
|
group.setRegionIds(REGION_IDS);
|
||
|
group.setRegionVal(REGION_VAL);
|
||
|
group.setRegionVals(REGION_VALS);
|
||
|
group.setGroupCls("44");
|
||
|
groupService.insertGroup(group);
|
||
|
// 先添加tbl_os_base
|
||
|
OsBase osBase = new OsBase();
|
||
|
osBase.setIsdel("0");
|
||
|
osBase.setBaseCls("1");
|
||
|
osBase.setRelCode("44");
|
||
|
osBase.setRelId(group.getId());
|
||
|
osBaseService.insertOsBase(osBase);
|
||
|
SocialBase socialBase = new SocialBase();
|
||
|
socialBase.setSocMans((String)key.get("SOC_MANS"));
|
||
|
socialBase.setSocPhones((String)key.get("SOC_PHONES"));
|
||
|
socialBase.setId(osBase.getId());
|
||
|
socialBase.setRegionId(REGION_ID);
|
||
|
socialBase.setRegionIds(REGION_IDS);
|
||
|
socialBase.setRegionVal(REGION_VAL);
|
||
|
socialBase.setRegionVals(REGION_VALS);
|
||
|
socialBase.setSocName((String)key.get("SOC_NAME"));
|
||
|
socialBase.setSocCode((String)key.get("SOC_CODE"));
|
||
|
socialBase.setSocLevel((String)key.get("SOC_LEVEL"));
|
||
|
socialBase.setSocIsrisk((String)key.get("SOC_ISRISK"));
|
||
|
socialBase.setSocProp((String)key.get("SOC_ISRISK"));
|
||
|
socialBase.setSocInd((String)key.get("SOC_IND"));
|
||
|
socialBase.setSocClass((String)key.get("SOC_CLASS"));
|
||
|
socialBase.setSocAddr((String)key.get("SOC_ADDR"));
|
||
|
socialBase.setSocLoc((String)key.get("SOC_LOC"));
|
||
|
socialBase.setIsdel("0");
|
||
|
//socialBase.setSocRs((String)key.get("SOC_RS"));
|
||
|
socialBaseService.insertSocialBase(socialBase);
|
||
|
//2020-05-27新增添加社会单位信息的同时将社会单位中的消防负责人加入社会单位关联表里面 方便与报警分级推送
|
||
|
for (int j = 0; j < SOC_PHONES.split(":").length; j++) {
|
||
|
String _arr = SOC_PHONES.split(":")[j];
|
||
|
SocialExtend extend = new SocialExtend();
|
||
|
extend.setBaseId(String.valueOf(osBase.getId()));
|
||
|
extend.setGroupId(osBase.getRelId());
|
||
|
extend.setGroupNames(socialBase.getRegionVal());
|
||
|
extend.setOrgType("44");
|
||
|
extend.setSocName(socialBase.getSocName());
|
||
|
extend.setPersonLevel("1");
|
||
|
extend.setUsersNames("旧平台导入");
|
||
|
extend.setPhones(_arr);
|
||
|
extend.setIsDel("0");
|
||
|
socialExtendService.insertSocialExtend(extend);
|
||
|
}
|
||
|
System.out.println(i);
|
||
|
}
|
||
|
System.out.println(_no);
|
||
|
*/
|
||
|
// jsonMap = new HashMap();
|
||
|
// Map _paramsMap = new HashMap();
|
||
|
// _paramsMap.put("baseId", baseId);
|
||
|
// _paramsMap.put("rsDueNum", new String());
|
||
|
// _paramsMap.put("rsTotalNum", new String());
|
||
|
// _paramsMap.put("rsYcz", new String());
|
||
|
// _paramsMap.put("rsCzz", new String());
|
||
|
// _paramsMap.put("rsWcz", new String());
|
||
|
// _paramsMap.put("rsSocLoc", new String());
|
||
|
// _paramsMap.put("rsData1", new ArrayList<Map<String, Object>>());
|
||
|
// _paramsMap.put("rsData2", new ArrayList<Map<String, Object>>());
|
||
|
// bdataService.callProcedure(_paramsMap, "Index1GetData");
|
||
|
// jsonMap.put("dueNum", _paramsMap.get("rsDueNum"));
|
||
|
// jsonMap.put("totalNum", _paramsMap.get("rsTotalNum"));
|
||
|
// jsonMap.put("ycz", _paramsMap.get("rsYcz"));
|
||
|
// jsonMap.put("czz", _paramsMap.get("rsCzz"));
|
||
|
// jsonMap.put("wcz", _paramsMap.get("rsWcz"));
|
||
|
// jsonMap.put("socLoc", _paramsMap.get("rsSocLoc"));
|
||
|
// jsonMap.put("rsData1", _paramsMap.get("rsData1"));
|
||
|
// jsonMap.put("rsData2", _paramsMap.get("rsData2"));
|
||
|
|
||
|
return this.writeJson("");
|
||
|
}
|
||
|
|
||
|
public static String readJsonFile(String fileName) {
|
||
|
String jsonStr = "";
|
||
|
try {
|
||
|
File jsonFile = new File(fileName);
|
||
|
FileReader fileReader = new FileReader(jsonFile);
|
||
|
Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
|
||
|
int ch = 0;
|
||
|
StringBuffer sb = new StringBuffer();
|
||
|
while ((ch = reader.read()) != -1) {
|
||
|
sb.append((char) ch);
|
||
|
}
|
||
|
fileReader.close();
|
||
|
reader.close();
|
||
|
jsonStr = sb.toString();
|
||
|
return jsonStr;
|
||
|
} catch (IOException e) {
|
||
|
e.printStackTrace();
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|