package action;
import java.io.IOException;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.Fangchan;
import model.Jiaofei;
import model.Tousu;
import model.User;
import model.Weixiu;
import model.Zhuhu;
import org.apache.struts2.ServletActionContext;
import util.Pager;
import util.Util;
import com.opensymphony.xwork2.ActionSupport;
import dao.FangchanDao;
import dao.JiaofeiDao;
import dao.TousuDao;
import dao.UserDao;
import dao.WeixiuDao;
import dao.ZhuhuDao;
public class ManageAction extends ActionSupport{
private static final long serialVersionUID = -4304509122548259589L;
private UserDao userDao;
private String url = "./";
public UserDao getUserDao() {
return userDao;
}
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
//程序入口界面
public String index(){
HttpServletRequest request = ServletActionContext.getRequest();
Util.init(request);
HttpSession session = request.getSession();
User user = (User)session.getAttribute("user");
if(user==null){
return "success2";
}else{
return "success1";
}
}
//用户登录操作
public String login() throws IOException {
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getParameter("username");
String password = request.getParameter("password");
String role = request.getParameter("role");
User user = userDao.selectBean(" where username = '"+username +"' and password= '"+password +"' and userlock=0 and role="+role);
if (user!=null) {
HttpSession session = request.getSession();
session.setAttribute("user", user);
this.setUrl("index");
return "redirect";
} else {
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("gbk");response.setContentType("text/html; charset=gbk");
response
.getWriter()
.print(
"<script language=javascript>alert('用户名或者密码错误');window.location.href='login.jsp';</script>");
}
return null;
}
//用户退出操作
public String loginout() {
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
session.removeAttribute("user");
this.setUrl("login.jsp");
return SUCCESS;
}
//跳转到修改密码页面
public String changepwd() {
this.setUrl("user/password.jsp");
return SUCCESS;
}
//修改密码操作
public void changepwd2() throws IOException {
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
User u = (User)session.getAttribute("user");
String password1 = request.getParameter("password1");
String password2 = request.getParameter("password2");
User bean = userDao.selectBean(" where username= '"+u.getUsername()+"' and password= '"+password1+"'");
if(bean!=null){
bean.setPassword(password2);
userDao.updateBean(bean);
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("gbk");response.setContentType("text/html; charset=gbk");
response
.getWriter()
.print(
"<script language=javascript>alert('修改成功');</script>");
}else{
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("gbk");response.setContentType("text/html; charset=gbk");
response
.getWriter()
.print(
"<script language=javascript>alert('用户名或者密码错误');</script>");
}
}
private ZhuhuDao zhuhuDao;
public ZhuhuDao getZhuhuDao() {
return zhuhuDao;
}
public void setZhuhuDao(ZhuhuDao zhuhuDao) {
this.zhuhuDao = zhuhuDao;
}
//业主列表
public String zhuhulist() {
HttpServletRequest request = ServletActionContext.getRequest();
String huzhuxingming = request.getParameter("huzhuxingming");
StringBuffer sb = new StringBuffer();
sb.append(" where ");
StringBuffer sb2 = new StringBuffer();
sb2.append(" where ");
if(huzhuxingming!=null&&!"".equals(huzhuxingming)){
sb.append("huzhuxingming like '%"+huzhuxingming+"%'");
sb.append(" and ");
sb2.append("huzhuxingming like '%"+huzhuxingming+"%'");
sb2.append(" and ");
request.setAttribute("huzhuxingming", huzhuxingming);
}
sb.append(" zhuhulock=0 order by id desc");
String where = sb.toString();
sb2.append(" zhuhulock=0 ");
String where2 = sb2.toString();
int currentpage = 1;
int pagesize =10;
if(request.getParameter("pagenum")!=null){
currentpage = Integer.parseInt(request.getParameter("pagenum"));
}
int total = zhuhuDao.selectBeanCount(where2);
request.setAttribute("list", zhuhuDao.selectBeanList((currentpage - 1) * pagesize, pagesize, where));
request.setAttribute("pagerinfo", Pager.getPagerNormal(total, pagesize,
currentpage, "method!zhuhulist", "共有" + total + "条记录"));
this.setUrl("zhuhu/zhuhulist.jsp");
return SUCCESS;
}
//跳转到添加业主页面
public String zhuhuadd() {
this.setUrl("zhuhu/zhuhuadd.jsp");
return SUCCESS;
}
//添加业主操作
public void zhuhuadd2() throws IOException {
HttpServletRequest request = ServletActionContext.getRequest();
String username = request.getParameter("username");
String dianhuahaoma = request.getParameter("dianhuahaoma");
String huzhusfz = request.getParameter("huzhusfz");
String huzhuxingming = request.getParameter("huzhuxingming");
String ruzhushijian = request.getParameter("ruzhushijian");
String zhuzhi = request.getParameter("zhuzhi");
User user = userDao.selectBean(" where username='"+username+"' and userlock=0");
if(user!=null){
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("gbk");response.setContentType("text/html; charset=gbk");
response
.getWriter()
.print(
"<script language=javascript>alert('操作失败,该身份证已经存在');window.location.href='method!zhuhulist';</script>");
return;
}
Zhuhu bean = new Zhuhu();
bean.setDianhuahaoma(dianhuahaoma);
bean.setHuzhusfz(huzhusfz);
bean.setHuzhuxingming(huzhuxingming);
bean.setRuzhushijian(ruzhushijian);
bean.setZhuzhi(zhuzhi);
zhuhuDao.insertBean(bean);
user = new User();
user.setCreatetime(new Date());
user.setPassword("111111");
user.setTruename(huzhuxingming);
user.setUsername(username);
user.setZhuhu(bean);
userDao.insertBean(user);
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("gbk");response.setContentType("text/html; charset=gbk");
response
.getWriter()
.print(
"<script language=javascript>alert('操作成功');window.location.href='method!zhuhulist';</script>");
}
//跳转到更新业主页面
public String zhuhuupdate() {
HttpServletRequest request = ServletActionContext.getRequest();
Zhuhu bean = zhuhuDao.selectBean(" where id= "+request.getParameter("id"));
request.setAttribute("bean", bean);
this.setUrl("zhuhu/zhuhuupdate.jsp");
return SUCCESS;
}
//更新业主操作
public void zhuhuupdate2() throws IOException {
HttpServletRequest request = ServletActionContext.getRequest();
String dianhuahaoma = request.getParameter("dianhuahaoma");
String huzhusfz = request.getParameter("huzhusfz");
String huzhuxingming = request.getParameter("huzhuxingming");
String ruzhushijian = request.getParameter("ruzhushijian");
String zhuzhi = request.getParameter("zhuzhi");
Zhuhu bean = zhuhuDao.selectBean(" where id= "+request.getParamet
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
小区物业管理系统(含数据库文件)源代码 (304个子文件)
ManageAction.class 29KB
Util.class 4KB
Jiaofei.class 3KB
Fangchan.class 3KB
Weixiu.class 2KB
Tousu.class 2KB
FangchanDaoImpl.class 2KB
User.class 2KB
JiaofeiDaoImpl.class 2KB
WeixiuDaoImpl.class 2KB
ZhuhuDaoImpl.class 2KB
TousuDaoImpl.class 2KB
UserDaoImpl.class 2KB
Pager.class 2KB
Zhuhu.class 2KB
FangchanDaoImpl$1.class 2KB
JiaofeiDaoImpl$1.class 2KB
WeixiuDaoImpl$1.class 2KB
TousuDaoImpl$1.class 2KB
ZhuhuDaoImpl$1.class 2KB
UserDaoImpl$1.class 2KB
FangchanDao.class 447B
JiaofeiDao.class 442B
WeixiuDao.class 437B
TousuDao.class 432B
ZhuhuDao.class 432B
UserDao.class 427B
.classpath 5KB
default.css 17KB
css.css 16KB
style.css 11KB
main.css 7KB
head.css 6KB
control.css 5KB
common1.css 4KB
style0.css 1KB
Thumbs.db 99KB
welcome.gif 164KB
ico.gif 13KB
top03.gif 9KB
ico15.gif 8KB
ico14.gif 8KB
ico16.gif 8KB
user_login_03.gif 7KB
ico13.gif 7KB
pic05.gif 5KB
bu13.gif 4KB
bu10.gif 4KB
nav03.gif 4KB
nav01.gif 4KB
bu09.gif 4KB
bu07.gif 4KB
bu04.gif 4KB
logo.gif 4KB
login-welcome.gif 3KB
bu05.gif 3KB
bu11.gif 3KB
bu06.gif 3KB
bu12.gif 3KB
bu08.gif 3KB
nopic.gif 3KB
shape01.gif 3KB
user_err.gif 3KB
bu02.gif 3KB
bu03.gif 3KB
bu01.gif 2KB
user_suc.gif 2KB
left_tab_Selected.gif 2KB
ico02.gif 2KB
ico24.gif 1KB
manage_top_bg.gif 1KB
nav02.gif 1KB
tab.gif 1KB
ico07.gif 1KB
line01.gif 935B
left_tab_Selectedno.gif 900B
offline.gif 896B
online.gif 888B
manage_arrow_down.gif 774B
manage_arrow_right.gif 774B
manage_arrow_left.gif 774B
manage_arrow_up.gif 774B
navbutton04.gif 662B
ico01.gif 654B
navbutton02.gif 635B
navbutton03.gif 576B
button_login2.gif 569B
top02.gif 559B
navbutton01.gif 547B
loadon.gif 538B
dhbutton01.gif 499B
dhbutton04.gif 499B
dhbutton03.gif 499B
dhbutton02.gif 499B
user_msg.gif 451B
dhbutton05.gif 415B
plus.gif 379B
user_login_01.gif 373B
ico12.gif 361B
minus.gif 328B
共 304 条
- 1
- 2
- 3
- 4
资源评论
- 生活教会我们2023-07-25这份文件给出了一个比较完整的小区物业管理系统的实现思路,对于初学者来说是一个很好的学习资料。
- 人亲卓玛2023-07-25这份文件提供了一个小区物业管理系统的源代码,能够为小区物业管理工作提供一定的帮助。
- 士多霹雳酱2023-07-25虽然这份文件可能不够完善,但是它提供了一个基础的框架,为用户提供了一个起点,可以根据自己的需求进行适配和改进。
- 一筐猪的头发丝2023-07-25这个文件提供的源代码清晰易懂,注释清晰,使得读者能够快速理解并进行二次开发。
- 三更寒天2023-07-25这个文件包含了完整的数据库文件,方便用户直接使用,节省了自己构建数据库的时间和精力。
铁柱0号
- 粉丝: 9
- 资源: 58
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功