protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("content-type", "text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); StringBuilder Str = new StringBuilder(""); String logmark = tostr.to_utf_8(request.getParameter("logmark")); if (logmark.equals("list")) // 打印数据 { String filename = ""; String mgid = tostr.to_utf_8(request.getParameter("mgid")); String ShowPage = tostr.to_utf_8(request.getParameter("page")); // 页码,起始值 1 String PageSize = tostr.to_utf_8(request.getParameter("rows")); // 每页显示行 if (!checkStr.checkIsNum(ShowPage)) ShowPage = "1"; if (!checkStr.checkIsNum(PageSize)) PageSize = "30"; if (!checkStr.checkIsNum(mgid)) filename = ""; else filename = mgid + "_systemlog.html"; FileTarget FileList = new AdapterFile(new ImgAdapter()); Map valueCol = FileList.FolderList( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/", filename); File[] file = (File[]) valueCol.get("filename"); if (file != null) { int totle = file.length; Str.append("{\"total\":").append(totle).append(",\"rows\":["); int totlePage = 0; if (totle > 0) { if (totle % Integer.parseInt(PageSize) == 0) totlePage = totle / Integer.parseInt(PageSize); // 共有多少页 else totlePage = totle / Integer.parseInt(PageSize) + 1; int posion = ((Integer.parseInt(ShowPage) - 1) * Integer.parseInt(PageSize)) + 1; // 游标的位置 (当前页 - 1) * 页面大小 + 1 int endData = Integer.parseInt(PageSize) * Integer.parseInt(ShowPage); for (int i = posion; i <= totle; i++) { if (i <= endData) { Str.append("{") .append("\"filename\":") .append("\"") .append(file[i - 1].getName().split("\\.")[0]) .append("\"") .append(",") .append("\"filetime\":") .append("\"") .append( nowdate .centrum("yyyy-MM-dd HH:mm") .format(new Date(file[i - 1].lastModified()))) .append("\"") .append("}") .append(","); } } } else { Str.append("{") .append("\"filename\":") .append("\"\"") .append(",") .append("\"filetime\":") .append("\"\"") .append("}") .append(","); } } else { Str.append("{\"total\":").append(0).append(",\"rows\":["); Str.append("{") .append("\"filename\":") .append("\"\"") .append(",") .append("\"filetime\":") .append("\"\"") .append("}") .append(","); } Str.delete(Str.length() - 1, Str.length()); Str.append("]}"); out.print(Str.toString()); Str.delete(0, Str.length()); // 清空 } }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("content-type", "text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); StringBuilder Str = new StringBuilder(""); String umark = tostr.to_utf_8(request.getParameter("umark")); if (umark.equals("mlist")) // 打印修改数据 { String storeid = tostr.to_utf_8(request.getParameter("storeid")); String FieldStr = "s.*", TableName = "store s", SqlWhere = ""; if (checkStr.checkIsNum(storeid)) { SqlWhere = "s.storeid=" + storeid; } Iterator UserIt = SingleUser.getInstance() .getUserDb() .UserList("y", "1", FieldStr, TableName, "", SqlWhere, "s.storeid", "asc") .iterator(); while (UserIt.hasNext()) { User_Pro pro = (User_Pro) UserIt.next(); if (pro != null) { Str.append("{") .append("\"storeid\":") .append("\"") .append(pro.getStoreid()) .append("\"") .append(",") .append("\"storename\":") .append("\"") .append(checkStr.String2Json(pro.getStorename())) .append("\"") .append(",") .append("\"director\":") .append("\"") .append(checkStr.String2Json(pro.getDirector())) .append("\"") .append(",") .append("\"sex\":") .append("\"") .append(pro.getSex()) .append("\"") .append(",") .append("\"birdate\":") .append("\"") .append(nowdate.set_date(pro.getBirdate(), "yyyy-MM-dd")) .append("\"") .append(",") .append("\"edu\":") .append("\"") .append(pro.getEducation()) .append("\"") .append(",") .append("\"tel\":") .append("\"") .append(checkStr.IsStrNull(pro.getTelnum())) .append("\"") .append(",") .append("\"qq\":") .append("\"") .append(checkStr.IsStrNull(pro.getQq())) .append("\"") .append(",") .append("\"email\":") .append("\"") .append(checkStr.IsStrNull(pro.getEmail())) .append("\"") .append(",") .append("\"areaid\":") .append("\"") .append(pro.getAreaid()) .append("\"") .append(",") .append("\"status\":") .append("\"") .append(pro.getStatus()) .append("\"") .append(",") .append("\"divide\":") .append("\"") .append(pro.getDivide() * 100) .append("\"") .append(",") .append("\"nodes\":") .append("\"") .append(checkStr.IsStrNull(pro.getNodes())) .append("\"") .append("}") .append(","); } else { Str.append("{") .append("\"storeid\":") .append("\"\"") .append(",") .append("\"storename\":") .append("\"\"") .append(",") .append("\"director\":") .append("\"\"") .append(",") .append("\"sex\":") .append("\"\"") .append(",") .append("\"birdate\":") .append("\"\"") .append(",") .append("\"edu\":") .append("\"\"") .append(",") .append("\"tel\":") .append("\"\"") .append(",") .append("\"qq\":") .append("\"\"") .append(",") .append("\"email\":") .append("\"\"") .append(",") .append("\"areaid\":") .append("\"\"") .append(",") .append("\"status\":") .append("\"\"") .append(",") .append("\"divide\":") .append("\"\"") .append(",") .append("\"nodes\":") .append("\"\"") .append("}") .append(","); } UserIt.remove(); } Str.delete(Str.length() - 1, Str.length()); out.print(Str.toString()); Str.delete(0, Str.length()); // 清空 out.flush(); out.close(); } }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("content-type", "text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); String UserStr = UserProxy.UserProxy(request); if (checkStr.isNull(UserStr)) { out.print("{\"err\":\"抱歉,您无权操作此模块\",\"msg\":\"\"}"); return; } String logmethod = tostr.to_utf_8(request.getParameter("logmethod")); if (logmethod.equals("clear")) // 清空 { if (checkStr.isNull(UserProxy.UserOptProxy(request, UserStr, "2"))) { out.print("{\"err\":\"抱歉,您无权操作此功能\",\"msg\":\"\"}"); return; } String logname = tostr.to_utf_8(request.getParameter("logname")); if (checkStr.isNull(logname)) { out.print("{\"err\":\"抱歉,请勿非法修改参数\",\"msg\":\"\"}"); return; } // 清空日志 Log.CreateFile( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/", logname + ".html", "<div style='width:100%;height:30px;line-height:30px;font-size:12px;border-bottom:solid 1px #000000;'>日志被 [" + UserStr.split(",")[1] + "]于" + nowdate.cu_datetime("yyyy-MM-dd HH:mm:ss") + "清空</div>\r\n", false); // 记录日志 Log.CreateFile( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/", UserStr.split(",")[0] + "_systemlog.html", "<div style='width:100%;height:30px;line-height:30px;font-size:12px;border-bottom:solid 1px #000000;'>用户 [" + UserStr.split(",")[1] + "]于" + nowdate.cu_datetime("yyyy-MM-dd HH:mm:ss") + "清空了名为 " + logname + " 的日志</div>\r\n" + Log.ReadFile( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/" + UserStr.split(",")[0] + "_systemlog.html"), false); out.print("{\"err\":\"\",\"msg\":\"日志清空成功\"}"); } else if (logmethod.equals("del")) // 删除 { if (checkStr.isNull(UserProxy.UserOptProxy(request, UserStr, "1"))) { out.print("{\"err\":\"抱歉,您无权操作此功能\",\"msg\":\"\"}"); return; } String logname = tostr.to_utf_8(request.getParameter("logname")); if (checkStr.isNull(logname)) { out.print("{\"err\":\"抱歉,请选择一条数据\",\"msg\":\"\"}"); return; } if (Log.FileDel( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/" + logname + ".html")) { // 记录日志 Log.CreateFile( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/", UserStr.split(",")[0] + "_systemlog.html", "<div style='width:100%;height:30px;line-height:30px;font-size:12px;border-bottom:solid 1px #000000;'>用户 [" + UserStr.split(",")[1] + "]于" + nowdate.cu_datetime("yyyy-MM-dd HH:mm:ss") + "删除了名为 " + logname + " 的日志</div>\r\n" + Log.ReadFile( request.getSession().getServletContext().getRealPath("/") + "Ds_admin/log/" + UserStr.split(",")[0] + "_systemlog.html"), false); out.print("{\"err\":\"\",\"msg\":\"日志删除成功\"}"); } else { out.print("{\"err\":\"抱歉,删除失败,请重试\",\"msg\":\"\"}"); } } else { out.print("{\"err\":\"请勿非法访问\",\"msg\":\"\"}"); } }
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setHeader("content-type", "text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); StringBuilder Str = new StringBuilder(""); String umark = tostr.to_utf_8(request.getParameter("umark")); if (umark.equals("plist")) // 打印分页数据 { String FieldStr = "s.*,p.provincename as provincename,p.provinceid as provinceid," + "c.cityname as cityname,c.cityid as cityid,a.areaname as areaname," + "nvl((select m.userid from manger_user m where m.userid=s.storeid),0) as ismg", TableName = "province p,city c,area a,store s", SqlWhere = " and p.provinceid=c.provinceid and c.cityid=a.cityid and a.areaid=s.areaid"; String storeid = tostr.to_utf_8(request.getParameter("storeid")); // 商户编号 String storepy = tostr.to_utf_8(request.getParameter("storepy")); // 商户名称或简拼 String director = tostr.to_utf_8(request.getParameter("director")); // 负责人 String tel = tostr.to_utf_8(request.getParameter("tel")); // 联系电话 String status = tostr.to_utf_8(request.getParameter("status")); // 商户状态 String mgstr = tostr.to_utf_8(request.getParameter("mgstr")); // 管理员映射用户 String egstr = tostr.to_utf_8(request.getParameter("egstr")); // 管理员映射用户修改 String m_userid = tostr.to_utf_8(request.getParameter("m_userid")); String ShowPage = tostr.to_utf_8(request.getParameter("page")); // 页码,起始值 1 String PageSize = tostr.to_utf_8(request.getParameter("rows")); // 每页显示行 if (checkStr.checkIsNum(storeid)) SqlWhere += " and s.storeid=" + storeid; if (!checkStr.isNull(storepy)) SqlWhere += " and (instr(s.storepy,'" + storepy.toUpperCase() + "')>0 or instr(s.storename,'" + storepy + "')>0)"; if (!checkStr.isNull(director)) SqlWhere += " and instr(s.director,'" + director + "')>0"; if (!checkStr.isNull(tel)) SqlWhere += " and instr(s.tel,'" + tel + "')>0"; if (checkStr.checkIsNum(status)) SqlWhere += " and s.status=" + status; if (mgstr.equals("y")) SqlWhere += " and s.storeid not in(select userid from manger_user) and s.status=0"; if (egstr.equals("y")) SqlWhere += " and s.storeid not in(select userid from manger_user where userid<>" + m_userid + ")"; if (!checkStr.checkIsNum(ShowPage)) ShowPage = "1"; if (!checkStr.checkIsNum(PageSize)) PageSize = "50"; Iterator UserIt = SingleUser.getInstance() .getUserPage() .UserPageList( FieldStr, TableName, SqlWhere, "s.storeid", "desc", Integer.parseInt(ShowPage), Integer.parseInt(PageSize)) .iterator(); Str.append("{\"total\":") .append(SingleUser.getInstance().getUserPage().getTotalRecord()) .append(",\"rows\":["); while (UserIt.hasNext()) { User_Pro pro = (User_Pro) UserIt.next(); if (pro != null) { Str.append("{") .append("\"storeid\":") .append("\"") .append(pro.getStoreid()) .append("\"") .append(",") .append("\"storename\":") .append("\"") .append(checkStr.String2Json(pro.getStorename())) .append("\"") .append(",") .append("\"storepy\":") .append("\"") .append(pro.getStorepy()) .append("\"") .append(",") .append("\"director\":") .append("\"") .append(checkStr.String2Json(pro.getDirector())) .append("\"") .append(",") .append("\"sex\":") .append("\"") .append(Field_Str.User_Sex[pro.getSex()]) .append("\"") .append(",") .append("\"birdate\":") .append("\"") .append(nowdate.set_date(pro.getBirdate(), "yyyy-MM-dd")) .append("\"") .append(",") .append("\"education\":") .append("\"") .append(Field_Str.User_Edu[pro.getEducation()]) .append("\"") .append(",") .append("\"tel\":") .append("\"") .append(checkStr.IsStrNull(pro.getTelnum())) .append("\"") .append(",") .append("\"qq\":") .append("\"") .append(checkStr.IsStrNull(pro.getQq())) .append("\"") .append(",") .append("\"email\":") .append("\"") .append(checkStr.IsStrNull(pro.getEmail())) .append("\"") .append(",") .append("\"areaname\":") .append("\"") .append(pro.getProvincename() + pro.getCityname() + pro.getAreaname()) .append("\"") .append(",") .append("\"provinceid\":") .append("\"") .append(pro.getProvinceid()) .append("\"") .append(",") .append("\"cityid\":") .append("\"") .append(pro.getCityid()) .append("\"") .append(",") .append("\"areaid\":") .append("\"") .append(pro.getAreaid()) .append("\"") .append(",") .append("\"status\":") .append("\"") .append(Field_Str.User_State[pro.getStatus()]) .append("\"") .append(",") .append("\"divide\":") .append("\"") .append(pro.getDivide() * 100) .append("%") .append("\"") .append(",") .append("\"regip\":") .append("\"") .append(checkStr.IsStrNull(pro.getRegip())) .append("\"") .append(",") .append("\"regtime\":") .append("\"") .append(nowdate.set_date(pro.getRegtime(), "yyyy/MM/dd HH:mm")) .append("\"") .append(",") .append("\"note\":") .append("\"") .append(checkStr.IsStrNull(pro.getNodes())) .append("\"") .append(",") .append("\"ismg\":") .append(pro.getIsmg()) .append("}") .append(","); } else { Str.append("{") .append("\"storeid\":") .append("\"\"") .append(",") .append("\"storename\":") .append("\"\"") .append(",") .append("\"storepy\":") .append("\"\"") .append(",") .append("\"director\":") .append("\"\"") .append(",") .append("\"sex\":") .append("\"\"") .append(",") .append("\"birdate\":") .append("\"\"") .append(",") .append("\"education\":") .append("\"\"") .append(",") .append("\"tel\":") .append("\"\"") .append(",") .append("\"qq\":") .append("\"\"") .append(",") .append("\"email\":") .append("\"\"") .append(",") .append("\"areaname\":") .append("\"\"") .append(",") .append("\"provinceid\":") .append("\"\"") .append(",") .append("\"cityid\":") .append("\"\"") .append(",") .append("\"areaid\":") .append("\"\"") .append(",") .append("\"status\":") .append("\"\"") .append(",") .append("\"divide\":") .append("\"\"") .append(",") .append("\"regip\":") .append("\"\"") .append(",") .append("\"regtime\":") .append("\"\"") .append(",") .append("\"note\":") .append("\"\"") .append(",") .append("\"ismg\":") .append("\"\"") .append("}") .append(","); } UserIt.remove(); } Str.delete(Str.length() - 1, Str.length()); Str.append("]}"); out.print(Str.toString()); Str.delete(0, Str.length()); // 清空 out.flush(); out.close(); } else if (umark.equals("olist")) // 订单添加这里显示 { String UserStr = UserProxy.UserSelect(request); String FieldStr = "s.*,'' as provincename,0 as provinceid," + "'' as cityname,0 as cityid,'' as areaname," + "0 as ismg", TableName = "store s", SqlWhere = " and s.status=0"; if (!checkStr.isNull(UserStr) && UserStr.contains(",")) { if (UserStr.split(",")[8].equals("1")) // 如果是1表示只能查看自己的订单 SqlWhere += " and s.storeid=" + UserStr.split(",")[0]; } String storepy = tostr.to_utf_8(request.getParameter("storepy")); // 商户名称或简拼 String ShowPage = tostr.to_utf_8(request.getParameter("page")); // 页码,起始值 1 String PageSize = tostr.to_utf_8(request.getParameter("rows")); // 每页显示行 if (!checkStr.isNull(storepy)) SqlWhere += " and (instr(s.storepy,'" + storepy.toUpperCase() + "')>0 or instr(s.storename,'" + storepy + "')>0)"; if (!checkStr.checkIsNum(ShowPage)) ShowPage = "1"; if (!checkStr.checkIsNum(PageSize)) PageSize = "50"; Iterator UserIt = SingleUser.getInstance() .getUserPage() .UserPageList( FieldStr, TableName, SqlWhere, "s.storeid", "desc", Integer.parseInt(ShowPage), Integer.parseInt(PageSize)) .iterator(); Str.append("{\"total\":") .append(SingleUser.getInstance().getUserPage().getTotalRecord()) .append(",\"rows\":["); while (UserIt.hasNext()) { User_Pro pro = (User_Pro) UserIt.next(); if (pro != null) { Str.append("{") .append("\"storeid\":") .append("\"") .append(pro.getStoreid()) .append("\"") .append(",") .append("\"storename\":") .append("\"") .append(checkStr.String2Json(pro.getStorename())) .append("\"") .append(",") .append("\"storepy\":") .append("\"") .append(pro.getStorepy()) .append("\"") .append(",") .append("\"director\":") .append("\"") .append(checkStr.String2Json(pro.getDirector())) .append("\"") .append(",") .append("\"sex\":") .append("\"") .append(Field_Str.User_Sex[pro.getSex()]) .append("\"") .append(",") .append("\"birdate\":") .append("\"") .append(nowdate.set_date(pro.getBirdate(), "yyyy-MM-dd")) .append("\"") .append(",") .append("\"education\":") .append("\"") .append(Field_Str.User_Edu[pro.getEducation()]) .append("\"") .append(",") .append("\"tel\":") .append("\"") .append(checkStr.IsStrNull(pro.getTelnum())) .append("\"") .append(",") .append("\"qq\":") .append("\"") .append(checkStr.IsStrNull(pro.getQq())) .append("\"") .append(",") .append("\"email\":") .append("\"") .append(checkStr.IsStrNull(pro.getEmail())) .append("\"") .append(",") .append("\"areaname\":") .append("\"") .append(pro.getProvincename() + pro.getCityname() + pro.getAreaname()) .append("\"") .append(",") .append("\"provinceid\":") .append("\"") .append(pro.getProvinceid()) .append("\"") .append(",") .append("\"cityid\":") .append("\"") .append(pro.getCityid()) .append("\"") .append(",") .append("\"areaid\":") .append("\"") .append(pro.getAreaid()) .append("\"") .append(",") .append("\"status\":") .append("\"") .append(Field_Str.User_State[pro.getStatus()]) .append("\"") .append(",") .append("\"divide\":") .append("\"") .append(pro.getDivide() * 100) .append("%") .append("\"") .append(",") .append("\"regip\":") .append("\"") .append(checkStr.IsStrNull(pro.getRegip())) .append("\"") .append(",") .append("\"regtime\":") .append("\"") .append(nowdate.set_date(pro.getRegtime(), "yyyy/MM/dd HH:mm")) .append("\"") .append(",") .append("\"note\":") .append("\"") .append(checkStr.IsStrNull(pro.getNodes())) .append("\"") .append(",") .append("\"ismg\":") .append(pro.getIsmg()) .append("}") .append(","); } else { Str.append("{") .append("\"storeid\":") .append("\"\"") .append(",") .append("\"storename\":") .append("\"\"") .append(",") .append("\"storepy\":") .append("\"\"") .append(",") .append("\"director\":") .append("\"\"") .append(",") .append("\"sex\":") .append("\"\"") .append(",") .append("\"birdate\":") .append("\"\"") .append(",") .append("\"education\":") .append("\"\"") .append(",") .append("\"tel\":") .append("\"\"") .append(",") .append("\"qq\":") .append("\"\"") .append(",") .append("\"email\":") .append("\"\"") .append(",") .append("\"areaname\":") .append("\"\"") .append(",") .append("\"provinceid\":") .append("\"\"") .append(",") .append("\"cityid\":") .append("\"\"") .append(",") .append("\"areaid\":") .append("\"\"") .append(",") .append("\"status\":") .append("\"\"") .append(",") .append("\"divide\":") .append("\"\"") .append(",") .append("\"regip\":") .append("\"\"") .append(",") .append("\"regtime\":") .append("\"\"") .append(",") .append("\"note\":") .append("\"\"") .append(",") .append("\"ismg\":") .append("\"\"") .append("}") .append(","); } UserIt.remove(); } Str.delete(Str.length() - 1, Str.length()); Str.append("]}"); out.print(Str.toString()); Str.delete(0, Str.length()); // 清空 out.flush(); out.close(); } }