二、系统展示
1.登陆页
2.房屋区域
3.合同管理
4.租金管理
5.押金管理
6.收费管理
7.租金统计
8.合同档案明细
9.代码库
10.业主信息
11.客户管理
12.房屋管理
三、部分代码
LoginServlet
package com.Team5.Servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.Team5.Bean.UserBean; import com.Team5.Dao.UserDao; /** * Servlet implementation class LoginServlet */ public class LoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public LoginServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse * response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub this.doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse * response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); HttpSession session = request.getSession(); PrintWriter out = response.getWriter(); String user_name = request.getParameter("user_name"); String pwd = request.getParameter("pwd"); // System.out.println(user_name); UserDao ud = new UserDao(); UserBean ub = ud.findUserByUname(user_name); if (ub != null) { if (ub.getUser_pwd().equals(pwd)) { session.setAttribute("user", ub); // response.sendRedirect("/HouseManager/JSP/MainWindows/index.jsp"); out.print("chg"); } else { out.print("密码错误!"); } } else { out.print("用户不存在!"); } } }
OwnerInfoServlet
package com.Team5.Servlet; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.Team5.Bean.DevelopersBean; import com.Team5.Bean.OwnerInfoBean; import com.Team5.Dao.DevelopersDao; import com.Team5.Dao.HouseDirectionDao; import com.Team5.Dao.OwnerInfoDao; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; /** * Servlet implementation class OwnerInfoDao */ public class OwnerInfoServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public OwnerInfoServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub this.doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("utf-8"); response.setContentType("text/html;charset=utf-8"); String edit = request.getParameter("edit"); System.out.println("edit==="+edit); if("add".equals(edit)){ try { int owner_number =Integer.parseInt(request.getParameter("owner_number")) ; String owner_name = request.getParameter("owner_name"); String owner_phoneNumber = request.getParameter("owner_phoneNumber"); String owner_address = request.getParameter("owner_address"); OwnerInfoDao OInfoD = new OwnerInfoDao(); int a=OInfoD.addOwnerInfo(owner_number, owner_name, owner_phoneNumber, owner_address); PrintWriter out = response.getWriter(); out.print("{'codes1':1,'message':'保存成功!'}"); out.flush(); out.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } else if("edit".equals(edit)){ try { String owner_number =request.getParameter("owner_number") ; String owner_name = request.getParameter("owner_name"); String owner_phoneNumber = request.getParameter("owner_phoneNumber"); String owner_address = request.getParameter("owner_address"); System.out.println("内容是"+owner_phoneNumber+"==="+owner_number); OwnerInfoDao OInfoD = new OwnerInfoDao(); int a =OInfoD.editOwnerInfo(owner_number, owner_name,owner_phoneNumber, owner_address); PrintWriter out = response.getWriter(); out.print("{\"codes1\":2,\"message\":\"修改成功!\"}"); System.out.print("chg"); out.flush(); out.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } }else if("view".equals(edit)){ try { OwnerInfoDao OInfoD = new OwnerInfoDao(); List<OwnerInfoBean> develist = OInfoD.getOwninfolist(); JSONObject obj = new JSONObject();//创建JSONOobj类型的obj对象 obj.put("total", develist.size());//堆栈先进后出,多少个obj对象 JSONArray array = new JSONArray();//创建JSONArray类型的array对象 array.addAll(develist);//把"row":[{},{}]添加到array中去 obj.put("rows", array);//堆栈先进后出, String json = obj.toString(); response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out.print(json.toString()); out.flush(); out.close(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } else{ String ss = request.getParameter("owner_id"); int a=Integer.parseInt(ss); try { OwnerInfoDao OInfoD = new OwnerInfoDao(); int b=OInfoD.delOwnerInfo(a); System.out.println("zhelishishanchu======"+ss); PrintWriter out = response.getWriter(); //out.print("success"); out.flush(); out.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }
AddHouseInfoServlet
package com.Team5.Servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.Team5.Bean.RentHouseInfoBean; import com.Team5.Dao.RentHouseInfoDao; /** * Servlet implementation class AddHouseInfoServlet */ public class AddHouseInfoServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public AddHouseInfoServlet() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doPost(request, response); } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub request.setCharacterEncoding("utf-8"); String num = request.getParameter("num"); String name = request.getParameter("name"); String property_name = request.getParameter("property_name"); String floorInfo_name = request.getParameter("floorInfo_name"); String houseD_name = request.getParameter("houseD_name"); String houseType_name = request.getParameter("houseType_name"); String floor = request.getParameter("Floor"); String houseS_name = request.getParameter("houseS_name"); String area = request.getParameter("area"); String rentState = request.getParameter("rentState"); if(rentState.equals("rent")) { rentState = "已出租"; }else if(rentState.equals("unrent")){ rentState = "未出租"; } String owner_name = request.getParameter("owner_name"); String detail = request.getParameter("detail"); RentHouseInfoBean rb = new RentHouseInfoBean(); rb.setRentHouse_number(num); rb.setRentHouse_name(name); rb.setProperty_name(property_name); rb.setRentHouse_belongFloor(floorInfo_name); rb.setRentHouse_direction(houseD_name); rb.setRentHouse_type(houseType_name); rb.setRentHouse_floor(floor); rb.setRentHouse_structure(houseS_name); rb.setRentHouse_aera(area); rb.setRentHouse_state(rentState); rb.setRentHouse_master(owner_name); rb.setRentHouse_memo(detail); RentHouseInfoDao rhid = new RentHouseInfoDao(); int i = rhid.addRentHouse(rb); response.setContentType("text/html; charset=UTF-8"); PrintWriter out = response.getWriter(); if(i==1){out.print("添加成功!");} else{out.print("添加失败!");} } }
CheckCodeServlet
package com.Team5.Servlet; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.Random; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.JPEGImageEncoder; public class CheckCodeServlet extends HttpServlet { private static final long serialVersionUID = -479885884254942306L; //设置验证码图片文字 public static final char[] CHARS = { '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' }; //取得随机数,用来随机获取验正文字 public static Random random = new Random(); public static String getRandomString() { StringBuffer buffer = new StringBuffer();//定义一个字符串缓存,用来存放验证码 for (int i = 0; i < 4; i++) {//循环六次,随机取得四个验正文字 buffer.append(CHARS[random.nextInt(CHARS.length)]); } return buffer.toString(); } public static Color getRandomColor() {//取得随机颜色 return new Color(random.nextInt(255), random.nextInt(255), random .nextInt(255)); } public static Color getReverseColor(Color c) {//取的某个颜色的前景色 return new Color(255 - c.getRed(), 255 - c.getGreen(), 255 - c .getBlue()); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("image/jpeg");//设置输出类型 String randomString = getRandomString();//调用函数,取得随机字符串 request.getSession(true).setAttribute("randomString", randomString);//放到Session中 System.out.println("这里是验证码字符"+randomString); //图片的宽度和高度 int width = 100; int height = 30; Color color = getRandomColor(); Color reverse = getReverseColor(color); 建立BufferedImage对象。指定图片的长度宽度和色彩。 BufferedImage bi = new BufferedImage(width, height,BufferedImage.TYPE_INT_RGB); Graphics2D g = bi.createGraphics();//获取绘图对象 g.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 16));//设置字体 g.setColor(color);//设置颜色 g.fillRect(0, 0, width, height);//绘制背景 g.setColor(reverse); g.drawString(randomString, 18, 20);//绘制随机字符串 for (int i = 0, n = random.nextInt(100); i < n; i++) {//画出最多100个噪点 g.drawRect(random.nextInt(width), random.nextInt(height), 1, 1); } // 转成JPEG格式 ServletOutputStream out = response.getOutputStream(); JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out); encoder.encode(bi); out.flush(); } public static void main(String[] args) { System.out.println(getRandomString()); } }
ClientinfoDao
package com.Team5.Dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.Team5.Bean.ClientinfoBean; public class ClientinfoDao { List<ClientinfoBean> clientlist; public ClientinfoDao(){ this.findAllClientInfo(); } public List<ClientinfoBean> findAllClientInfo() { // TODO Auto-generated method stub List<ClientinfoBean>celist = new ArrayList<ClientinfoBean>(); ConnDriver cd = new ConnDriver(); int rel=0; try { Connection conn = cd.condri(); String sql="select client_number,client_name,client_phoneNumber,client_MobileNumber,client_address,client_companyName,client_legalPerson,"+ "client_legalPersonIDNumber,client_licenseNumber,client_employeeNumber,client_memo from clientinfo"; PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while(rs.next()){ ClientinfoBean rb = new ClientinfoBean(); rb.setClient_number(rs.getString(1)); rb.setClient_name(rs.getString(2)); rb.setClient_phoneNumber(rs.getString(3)); rb.setClient_MobileNumber(rs.getString(4)); rb.setClient_address(rs.getString(5)); rb.setClient_companyName(rs.getString(6)); rb.setClient_legalPerson(rs.getString(7)); rb.setClient_legalPersonIDNumber(rs.getString(8)); rb.setClient_licenseNumber(rs.getString(9)); rb.setClient_employeeNumber(rs.getString(10)); rb.setClient_memo(rs.getString(11)); celist.add(rb); } ps.close(); conn.close(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return celist; } public List<ClientinfoBean> findOneClientById(String num, String name) { // TODO Auto-generated method stub ConnDriver cd = new ConnDriver(); ClientinfoBean rb=null; List<ClientinfoBean>celist = new ArrayList<ClientinfoBean>(); int rel=0; try { Connection conn = cd.condri(); String whe=""; if (num !=null && !"".equals(num)) { whe+=" and client_number='"+num+"'"; } if (name !=null && !"".equals(name)) { whe+=" and client_name='"+name+"'"; } String sql="select client_number,client_name,client_phoneNumber,client_MobileNumber,client_address,client_companyName,client_legalPerson,"+ "client_legalPersonIDNumber,client_licenseNumber,client_employeeNumber,client_memo from clientinfo where 1=1"+whe+""; PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while(rs.next()){ rb = new ClientinfoBean(); rb.setClient_number(rs.getString(1)); rb.setClient_name(rs.getString(2)); rb.setClient_phoneNumber(rs.getString(3)); rb.setClient_MobileNumber(rs.getString(4)); rb.setClient_address(rs.getString(5)); rb.setClient_companyName(rs.getString(6)); rb.setClient_legalPerson(rs.getString(7)); rb.setClient_legalPersonIDNumber(rs.getString(8)); rb.setClient_licenseNumber(rs.getString(9)); rb.setClient_employeeNumber(rs.getString(10)); rb.setClient_memo(rs.getString(11)); celist.add(rb); } ps.close(); conn.close(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return celist; } public int AddClientAll(ClientinfoBean ClientInfo) throws ClassNotFoundException { ArrayList<ClientinfoBean> clientlist = new ArrayList<ClientinfoBean>(); Connection conn = null; PreparedStatement pstm = null; int i = 0; try { conn = ConnDriver.condri(); String sql = "insert into clientinfo(client_number,client_name," + "client_phoneNumber,client_MobileNumber,client_address," + "client_companyName,client_legalPerson,client_legalPersonIDNumber," + "client_licenseNumber,client_employeeNumber,client_memo) " + " values(?,?,?,?,?,?,?,?,?,?,?)"; pstm = conn.prepareStatement(sql); pstm.setString(1, ClientInfo.getClient_number()); pstm.setString(2, ClientInfo.getClient_name()); pstm.setString(3, ClientInfo.getClient_phoneNumber()); pstm.setString(4, ClientInfo.getClient_MobileNumber()); pstm.setString(5, ClientInfo.getClient_address()); pstm.setString(6, ClientInfo.getClient_companyName()); pstm.setString(7, ClientInfo.getClient_legalPerson()); pstm.setString(8, ClientInfo.getClient_legalPersonIDNumber()); pstm.setString(9, ClientInfo.getClient_licenseNumber()); pstm.setString(10, ClientInfo.getClient_employeeNumber()); pstm.setString(11, ClientInfo.getClient_memo()); i = pstm.executeUpdate(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } return i; } public int EditClientAll(String num, String name, String phone,String mobile,String address,String contacts,String frname,String number,String license,String employee, String memo) throws Exception { Connection conn = null; Statement Epstm = null; int i = 0; conn = ConnDriver.condri(); String sql = "update clientinfo set client_number='" + num+ "', client_name='" + name + "',client_phoneNumber='" + phone + "',client_MobileNumber='" + mobile + "',client_address='" + address + "',client_companyName='"+ contacts + "',client_legalPerson='" + frname+ "',client_legalPersonIDNumber='" + number + "',client_licenseNumber='"+ license + "',client_employeeNumber='" + employee + "',client_memo='" + memo + "' where client_number='" + num +"'"; Epstm = conn.createStatement(); i = Epstm.executeUpdate(sql); return i; } public int delClient(String client_number) throws Exception{ int rlt = 0; Connection conn = null; conn = ConnDriver.condri(); String sql="delete from clientinfo where client_number='"+client_number+"'"; PreparedStatement stmt = conn.prepareStatement(sql); rlt=stmt.executeUpdate(); return rlt; } public List<ClientinfoBean> findAllCustomer() { // TODO Auto-generated method stub List<ClientinfoBean> Customerlist = new ArrayList<ClientinfoBean>(); try { Connection conn = ConnDriver.condri(); String sql="select client_number,client_name," + "client_sex,client_IDNumber," + "client_phoneNumber,client_address " + " from clientinfo"; PreparedStatement ps = conn.prepareStatement(sql); ResultSet rs = ps.executeQuery(); while(rs.next()){ ClientinfoBean rb = new ClientinfoBean(); rb.setClient_number(rs.getString(1)); rb.setClient_name(rs.getString(2)); rb.setClient_sex(rs.getString(3)); rb.setClient_IDNumber(rs.getString(4)); rb.setClient_phoneNumber(rs.getString(5)); rb.setClient_address(rs.getString(6)); Customerlist.add(rb); } ps.close(); conn.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return Customerlist; } public List<ClientinfoBean> findContractInfoByChaxun(String client_number, String client_name) { List<ClientinfoBean>celist = new ArrayList<ClientinfoBean>(); ConnDriver cd = new ConnDriver(); int rel=0; Connection conn = null; PreparedStatement ps = null; ResultSet rs = null; try { conn = cd.condri(); String s=""; if(client_name!=null && !"".equals(client_name)){ s+="and client_name='"+client_name+"'"; } else if(client_number!=null && !"".equals(client_number)){ s+="and client_number='"+client_number+"'"; } String sql="select client_number,client_name,client_phoneNumber,client_MobileNumber,client_address,client_companyName,client_legalPerson,"+ "client_legalPersonIDNumber,client_licenseNumber,client_employeeNumber,client_memo from clientinfo where 1=1 "+s; ps = conn.prepareStatement(sql); rs = ps.executeQuery(); while(rs.next()){ ClientinfoBean rb = new ClientinfoBean(); rb.setClient_number(rs.getString(1)); rb.setClient_name(rs.getString(2)); rb.setClient_phoneNumber(rs.getString(3)); rb.setClient_MobileNumber(rs.getString(4)); rb.setClient_address(rs.getString(5)); rb.setClient_companyName(rs.getString(6)); rb.setClient_legalPerson(rs.getString(7)); rb.setClient_legalPersonIDNumber(rs.getString(8)); rb.setClient_licenseNumber(rs.getString(9)); rb.setClient_employeeNumber(rs.getString(10)); rb.setClient_memo(rs.getString(11)); celist.add(rb); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); }finally{ try { ps.close(); } catch (SQLException e) { e.printStackTrace(); } try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } return celist; } public List<ClientinfoBean> getClientlist() { return clientlist; } public void setClientlist(List<ClientinfoBean> clientlist) { this.clientlist = clientlist; } }
ConnDriver
package com.Team5.Dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class ConnDriver { public static Connection condri() throws ClassNotFoundException, SQLException { Class.forName("com.mysql.cj.jdbc.Driver"); // String url = "jdbc:mysql://10.3.4.10/housedatabase?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false"; String url = "jdbc:mysql://localhost:3306/housedatabase?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8&useSSL=false"; Connection conn = DriverManager.getConnection(url, "root", "123456"); return conn; } public static Connection condri(String url,String admin,String password) throws ClassNotFoundException, SQLException { Class.forName("com.mysql.cj.jdbc.Driver"); Connection conn = DriverManager.getConnection(url, admin, password); return conn; } }
SelectTag
package com.Team5.Tag; import java.lang.reflect.Method; import java.util.List; import javax.servlet.jsp.JspException; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.Tag; public class SelectTag implements Tag { private PageContext pageContext; private String value; private String text; private String name; private String id; private List items; private String custom; @Override public int doEndTag() throws JspException { try{ String str_custom = ""; if (custom != null) { str_custom = custom; } JspWriter out = pageContext.getOut(); out.println("<select name='"+name+"' id='"+id+"' " + custom + " style='width:100%;'>"); out.println("<option value=\"null\">请选择...</option>"); for (Object item : items) { //返回itme对象所属的类,并把类赋值给clazz Class clazz = item.getClass(); Method m1 = clazz.getDeclaredMethod(this.getMethodName(value));//m1==getClassNum() //Method m1 = clazz.getDeclaredMethod(this.getMethodName(classNum)) //Method m1 = clazz.getDeclaredMethod(getClassNum) //m1==getClassNum() Method m2 = clazz.getDeclaredMethod(this.getMethodName(text));//m2==getClassName() //Method m2 = clazz.getDeclaredMethod(this.getMethodName(className)) //Method m2 = clazz.getDeclaredMethod(getClassName) //m2==getClassName() out.println("<option value='"+m1.invoke(item)+"'>"+m2.invoke(item)+"</option>"); } out.print("</select>"); }catch(Exception e){ e.printStackTrace(); } return 0; } @Override public int doStartTag() throws JspException { return 0; } private String getMethodName(String property){ String mn="get"; mn=mn+property.substring(0, 1).toUpperCase()+property.substring(1); return mn; } @Override public Tag getParent() { return null; } @Override public void release() { } @Override public void setPageContext(PageContext arg0) { this.pageContext=arg0; } @Override public void setParent(Tag arg0) { } public void setValue(String value) { this.value = value; } public void setText(String text) { this.text = text; } public void setName(String name) { this.name = name; } public void setItems(List items) { this.items = items; } public void setId(String id) { this.id = id; } public String getCustom() { return custom; } public void setCustom(String custom) { this.custom = custom; } }
HouseManager.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <base href="<%=basePath%>" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>房屋管理</title> <link rel="stylesheet" type="text/css" href="UI/CSS/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="UI/CSS/themes/icon.css"> <link rel="stylesheet" type="text/css" href="UI/CSS/demo.css"> <script type="text/javascript" src="UI/JS/jquery.min.js"></script> <script type="text/javascript" src="UI/JS/jquery.easyui.min.js"></script> <script type="text/javascript" src="UI/JS/fenye.js"></script> </head> <body class="easyui-layout" data-options="fit:'true'"> <div data-options="region:'north',border:false" style="height: 50px; background: #B3DFDA; padding: 3px"> <table> <tr> <td style="width: 150px;" align="center"><img src="UI/CSS/themes/icons/large_chart.png"></td> <td> <table> <tr><td colspan="3"><b><font style="font-size: 15px;">房屋档案管理流程</font></b></td></tr> <tr> <td style="width: 150px;">1、建立物业信息</td> <td style="width: 150px;">2、建立楼宇信息</td> <td style="width: 150px;">3、建立出租房信息</td> </tr> </table> </td> </tr> </table> </div> <div data-options="region:'center'" > <div class="easyui-tabs" data-options="tools:'#tab-tools',fit:'true'" > <div title="物业信息" style="padding: 10px;" href="JSP/HouseManager/PropertyInfo.jsp"></div> <div title="楼宇信息" style="padding:10px;" href="JSP/HouseManager/FloorInfo.jsp"></div> <div title="出租房信息" style="padding:0px;" href="JSP/HouseManager/RentHouseInfo.jsp"></div> </div> </div> </body> </html>
MoneyManager.jsp
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <%@ taglib prefix="my" uri="http://mytag/Select" %> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <base href="<%=basePath%>" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>收费管理</title> <link rel="stylesheet" type="text/css" href="UI/CSS/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="UI/CSS/themes/icon.css"> <link rel="stylesheet" type="text/css" href="UI/CSS/demo.css"> <script type="text/javascript" src="UI/JS/jquery-1.9.1.js"></script> <script type="text/javascript" src="UI/JS/jquery.easyui.min.js"></script> <script type="text/javascript" src="UI/JS/time.js"></script> </head> <body class="easyui-layout" onload="startclock()"> <div data-options="region:'north',border:false" style="height: 90px; background: #B3DFDA; padding: 3px"> <div id="Mmenu2" class="Mmenu" style="height: 45px, width:100%"> <ul> <li><a onclick="$('#AddMoneyInfo').dialog('open')"> <img src="images/home.png" align="middle">新增收费 </a></li> <li><a onclick="$('#ImportCostStatistic').dialog('open')"> <img src="images/part-import.png" align="middle">批量导入 </a></li> <li><a onclick="editCost_OpenDialog();"> <img src="images/edit-file.png" align="middle">编辑收费 </a></li> <li><a type="button" onclick="DeleteCostStatistic()"> <img src="images/delete.png" align="middle">删除收费 </a></li> <li><a onclick="SetReceipt()"> <img src="images/viewAll.png" align="middle">设置已收费</a></li> <li><a onclick="$('#ViewAllCostStatistic').datagrid('load',{})"> <img src="images/refresh.png" align="middle">刷新列表</a></li> <li><a onclick="printNotice()"> <img src="images/print.png" align="middle">打印催费单 </a></li> <li><a onclick="printNotice()"> <img src="images/this-year.png" align="middle">批量催费单</a></li> <li><a onclick="printNotice()"> <img src="images/print.png" align="middle">打印收费单 </a></li> <li><a onclick="printNotice()"> <img src="images/tickets.png" align="middle">批量收款单 </a></li> <li><a href="JSP/MainWindows/index.jsp"> <img src="images/loginOut.png" align="middle">离开 </a></li> </ul> </div> <script type="text/javascript"> function show1(value){ $('#ViewAllCostStatistic').datagrid('load',{moneystyle:value}); } function show2(value){ $('#ViewAllCostStatistic').datagrid('load',{ifduqian:value}); } </script> <div id="showPrint"></div> <script type="text/javascript"> function printNotice(){ $("#showPrint").window({href:"JSP/MoneyManager/MoneyMangerprint.jsp",width:500,height:350}); $("#showPrint").window('open'); //$("#showPrint").window('refresh'); } </script> <div> <table border="0" style="position:absolute; top:53px;width=100%;"> <tr> <td style="height: 30px;width: 90px;"><font size="5">当前操作费用:</font></td> <td style="height: 30px;width: 100px;"> <jsp:useBean id="costSubject" class="com.Team5.Dao.CostsubjectDao"></jsp:useBean> <my:select items="${costSubject.costSublist }" custom="οnchange='show1(this.value)'" name="costSubject_name" value="costSubject_name" text="costSubject_name"></my:select> </td> <td style="height: 30px;width: 150px;" align="right">收费情况</td> <td> <select name="status" onchange="show2(this.value)" id="status"> <option value="bx">不限</option> <option value="receive">已收费</option> <option value="noreceive">未收费</option> </select> </td> <td style="width: 50px;"></td> <td style="height: 30px;width: 500px;"> <fieldset> <table> <tr> <td style="height: 30px;width: 80px;">客户名称</td> <td><input type="text" name="Client_Name" id="select_client" style="width:120px;height: 20px;"></td> <td><input type="button" value="查找" onclick="xselect()" style="width:60px;height: 25px;"></td> <td><input type="button" value="全部" onclick="$('#ViewAllCostStatistic').datagrid('load',{})" style="width:60px;height: 25px;"></td> </tr> </table> </fieldset> </td> </tr> </table> </div> </div> <script type="text/javascript"> function xselect(){ var customer = document.getElementById('select_client').value; $('#ViewAllCostStatistic').datagrid('load',{customer:customer}); } </script> <div data-options="region:'west',split:true" title="导航栏" style="width:200px;"> <ul id="tt" class="easyui-tree"> <li><span>全部房屋</span> <ul> <li><span><a onclick="$('#ViewAllCostStatistic').datagrid({url:'CostStatisticServlet?MoneyInfoOperate=MonthSelect&StartTime=2014-01-01&EndTime=2014-12-31'});">2014年</a></span> <ul> <li><a onclick="$('#ViewAllCostStatistic').datagrid({url:'CostStatisticServlet?MoneyInfoOperate=MonthSelect&StartTime=2014-10-01&EndTime=2014-10-31'});">10月</a></li> </ul> </li> <li><span><a onclick="$('#ViewAllCostStatistic').datagrid({url:'CostStatisticServlet?MoneyInfoOperate=MonthSelect&StartTime=2013-01-01&EndTime=2013-12-31'});">2013年</a></span> <ul> <li><a onclick="$('#ViewAllCostStatistic').datagrid({url:'CostStatisticServlet?MoneyInfoOperate=MonthSelect&StartTime=2013-06-06&EndTime=2013-06-31'});">06月</a></li> </ul> </li> </ul> </li> </ul> </div> <div data-options="region:'south',border:false" style="height: 30px; background: #A9FACD;"> <table border="1" cellspacing="0" height="28px"> <tr> <td width="500px">【房屋租赁管理系统——网页版】</td> <td width="600px"> <form name="clock" onsubmit="0"> 【当前时间:<input type="text" name="face" size="14">】 </form> </td> <td width="400px">【数据库:本地数据库】</td> </tr> </table> </div> <div data-options="region:'center',title:'工作区'"> <div class="easyui-layout" data-options="fit:true"> <div data-options="region:'center'" style="padding:3px" id="ViewRegion"> <table id="ViewAllCostStatistic" class="easyui-datagrid" data-options="rownumbers:true,url:'CostStatisticServlet',selectOnCheck:true, singleSelect:true,autoRowHeight:false,fit:'true',pagination:true,pageSize:10"> <thead> <tr> <th data-options="field:'ck',checkbox:true"></th> <th data-options="field:'costStatistic_id',width:40">编号</th> <th data-options="field:'costStatistic_period',width:68">费用期间</th> <th data-options="field:'costStatistic_name',width:60">科目名称</th> <th data-options="field:'costStatistic_houseNumber',width:80">房屋名称</th> <th data-options="field:'costStatistic_clientName',width:170">客户名称</th> <th data-options="field:'costStatistic_startTime',width:68">计费周期始</th> <th data-options="field:'costStatistic_endTime',width:68">计费周期止</th> <th data-options="field:'costStatistic_startNumber',width:30">起数</th> <th data-options="field:'costStatistic_endNumber',width:30">止数</th> <th data-options="field:'costStatistic_quantity',width:50">用量</th> <th data-options="field:'costStatistic_price',width:40">计费标准</th> <th data-options="field:'costStatistic_amount',width:60">金额</th> <th data-options="field:'costStatistic_receipt',width:60">是否收款</th> <th data-options="field:'costStatistic_receiptMan',width:60">收款人</th> <th data-options="field:'costStatistic_receiptDate',width:68">收款日期</th> <th data-options="field:'costStatistic_receiptType',width:60">收款方式</th> <th data-options="field:'costStatistic_contractID',width:60">合同编号</th> </tr> </thead> </tbody> </table> </div> </div> </div> <jsp:include page="MoneyManageDialog.jsp"></jsp:include> <script type="text/javascript"> //双击行弹出编辑窗口,;form(load加载数据)单击选中,然后编辑,便可弹出编辑窗口 $('#ViewAllCostStatistic').datagrid({ onDblClickRow : function(rowIndex, rowData) { var row = $('#ViewAllCostStatistic').datagrid('getSelected'); if(row) { $('#EditMoneyInfo').dialog('open'); $('#EditCostStatistic_Form').form('load', document.getElementById('costStatistic_id').value = row.costStatistic_id, document.getElementById('Cost_CostName_edit').value = row.costStatistic_subject, document.getElementById('Cost_CustomerName_edit').value = row.costStatistic_clientName, document.getElementById('Cost_ContractNumber_edit').value = row.costStatistic_contractID, document.getElementById('Cost_HouseNumber_edit').value = row.costStatistic_houseNumber, document.getElementById('Cost_StartDate_edit').value = row.costStatistic_startTime, document.getElementById('Cost_EndDate_edit').value = row.costStatistic_endTime, document.getElementById('Cost_StartNumber_edit').value = row.costStatistic_startNumber, document.getElementById('Cost_EndNumber_edit').value = row.costStatistic_endNumber, document.getElementById('Cost_Quantity_edit').value = row.costStatistic_quantity, document.getElementById('Cost_UnitPrice_edit').value = row.costStatistic_price, document.getElementById('Cost_Amount_edit').value = row.costStatistic_amount, document.getElementById('Cost_Receipt_edit').value = row.costStatistic_receipt, document.getElementById('Cost_ReceiptMan_edit').value = row.costStatistic_receiptMan, document.getElementById('Cost_ReceiptDate_edit').value = row.costStatistic_receiptDate); } } }); //单击选中,然后编辑,便可弹出编辑窗口的方法 function editCost_OpenDialog(){ var row = $('#ViewAllCostStatistic').datagrid('getSelected'); if(row) { $('#EditMoneyInfo').dialog('open'); $('#EditCostStatistic_Form').form('load', document.getElementById('costStatistic_id').value = row.costStatistic_id, document.getElementById('Cost_CostName_edit').value = row.costStatistic_subject,//费用科目 document.getElementById('Cost_CustomerName_edit').value = row.costStatistic_clientName,//客户名称 document.getElementById('Cost_ContractNumber_edit').value = row.costStatistic_contractID,//合同编号 document.getElementById('Cost_HouseNumber_edit').value = row.costStatistic_houseNumber,//房屋名称 document.getElementById('Cost_StartDate_edit').value = row.costStatistic_startTime,//起始时间 document.getElementById('Cost_EndDate_edit').value = row.costStatistic_endTime,//结束时间 document.getElementById('Cost_StartNumber_edit').value = row.costStatistic_startNumber,//起始数字 document.getElementById('Cost_EndNumber_edit').value = row.costStatistic_endNumber,//结束数字 document.getElementById('Cost_Quantity_edit').value = row.costStatistic_quantity,//用量 document.getElementById('Cost_UnitPrice_edit').value = row.costStatistic_price,//计费标准 document.getElementById('Cost_Amount_edit').value = row.costStatistic_amount,//金额 document.getElementById('Cost_Receipt_edit').value = row.costStatistic_receipt,//是否收款 document.getElementById('Cost_ReceiptMan_edit').value = row.costStatistic_receiptMan,//收款人 document.getElementById('Cost_ReceiptDate_edit').value = row.costStatistic_receiptDate);//收款日期 }else{ alert("请选中一条数据!!"); } } //删除操作 function DeleteCostStatistic() { var row = $('#ViewAllCostStatistic').datagrid('getSelected');//获得删除行 var param={costStatistic_id:row.costStatistic_id,MoneyInfoOperate:'del'}; //获得删除的参数property_number;delProperty相当于add,edit alert("是否删除编号为"+row.costStatistic_id+"的记录?");//弹出框 $.post('CostStatisticServlet',param,function(data){ if (data == 'success') { alert("删除成功"); $('#ViewAllCostStatistic').datagrid('load',{});//实现删除操作的刷新表 } else { //document.getElementById("aaa").innerHTML=data; alert("删除失败"); } }); } </script> <script type="text/javascript"> function SetReceipt(){ var row = $('#ViewAllCostStatistic').datagrid('getSelected'); if(row) { //alert(row.costStatistic_id); document.getElementById('SetCharge_CostSta_id').value = row.costStatistic_id; $('#SetCharge').dialog('open'); }else{ alert("请单击每行首列的复选框,选中一行!"); } } </script> <script> function pagerFilter(data){ if (typeof data.length == 'number' && typeof data.splice == 'function'){ // is array data = { total: data.length, rows: data } } var dg = $(this); var opts = dg.datagrid('options'); var pager = dg.datagrid('getPager'); pager.pagination({ onSelectPage:function(pageNum, pageSize){ opts.pageNumber = pageNum; opts.pageSize = pageSize; pager.pagination('refresh',{ pageNumber:pageNum, pageSize:pageSize }); dg.datagrid('loadData',data); } }); if (!data.originalRows){ data.originalRows = (data.rows); } var start = (opts.pageNumber-1)*parseInt(opts.pageSize); var end = start + parseInt(opts.pageSize); data.rows = (data.originalRows.slice(start, end)); return data; } $(function(){ $('#ViewAllCostStatistic').datagrid({loadFilter:pagerFilter}); }); </script> </body> </html>
四、其他
1.获取源码
点击以下链接获取源码,数据库文件在sql文件夹下面。
JavaWeb房屋租赁管理系统源码(servlet+jsp+mysql)
2.点赞加关注
如果您觉得这篇文章对你有用请关注加点赞;