package com.general.action;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.general.model.Address;
import com.general.model.Collective;
import com.general.model.Household;
import com.general.model.Resident;
import com.general.service.IAddressService;
import com.general.service.ICollectiveService;
import com.general.service.IHouseholdService;
import com.general.service.IResidentService;
import com.general.service.imp.AddressService;
import com.general.service.imp.CollectiveService;
import com.general.service.imp.HouseholdService;
import com.general.service.imp.ResidentService;
/**
* Servlet implementation class HouseholdManage
*/
@WebServlet("/servlet/householdmanage")
public class HouseholdManage extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String param = request.getParameter("func");
switch (param) {
case "searchHouseholdDetail":
searchHouseholdDetail(request, response);
break;
case "deleteHouseholdMember":
deleteHouseholdMember(request, response);
break;
case "deleteHouseholdAddress":
break;
case "deleteHousehold":
break;
case "searchCollectiveDetail":
searchCollectiveDetail(request, response);
break;
case "deleteCollectiveMember":
deleteCollectiveMember(request, response);
break;
case "deleteCollectiveAddress":
break;
case "deleteCollective":
break;
default:
break;
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String param = request.getParameter("func");
switch (param) {
case "addHousehold":
addHousehold(request, response);
break;
case "searchHousehold":
searchHousehold(request, response);
break;
case "searchHouseholdAll":
searchHouseholdAll(request, response);
break;
case "addHouseholdMember":
addHouseholdMember(request, response);
break;
case "searchHouseholdDetail":
searchHouseholdDetail(request, response);
break;
case "addCollective":
addCollective(request, response);
break;
case "searchCollective":
searchCollective(request, response);
break;
case "searchCollectiveAll":
searchCollectiveAll(request, response);
break;
case "addCollectiveMember":
addCollectiveMember(request, response);
break;
case "searchCollectiveDetail":
searchCollectiveDetail(request, response);
break;
case "addAddress":
addAddress(request,response);
break;
default:
break;
}
}
public void addHousehold(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//家庭户口注册
String personal_id = request.getParameter("personal_id");
Household hosehold = new Household();
hosehold.setPersonal_id(personal_id);
IHouseholdService householdService = new HouseholdService();
if(householdService.findByPersonalId(personal_id) == null)
householdService.insert(hosehold);
hosehold = householdService.findByPersonalId(personal_id);
List<String> members_id = new ArrayList<>();
members_id.add(personal_id);
householdService.batchUpdateResidentHouseholdId(members_id, hosehold);//修改户主的家庭户口id
//
response.sendRedirect("/HMS/HMS/admin/household_manage/add_housemember.html?personal_id="+personal_id);
}
public void searchHousehold(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String member_id = request.getParameter("member_id");
IHouseholdService householdService = new HouseholdService();
Household household = householdService.searchHousehold(member_id);
if(household != null) {
request.setAttribute("message", "successfully");
IResidentService residentService = new ResidentService();
Resident resident = residentService.findById(household.getPersonal_id());
List<Resident> lists = new ArrayList<>();
lists.add(resident);
request.setAttribute("personals", lists);
}else {
request.setAttribute("message", "not find");
}
ServletContext application = this.getServletContext();
RequestDispatcher requestDispatcher = application.getRequestDispatcher("/HMS/admin/household_manage/search_householdresult.jsp");
requestDispatcher.forward(request, response);
}
public void searchHouseholdAll(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
IHouseholdService householdService = new HouseholdService();
IResidentService residentService = new ResidentService();
List<Household> lists = householdService.findAll();
List<Resident> residents = new ArrayList<>();
for(int i=0; i<lists.size(); i++) {
Resident resident = residentService.findById(lists.get(i).getPersonal_id());
residents.add(resident);
}
if(!residents.isEmpty()) {
request.setAttribute("personals", residents);
}else {
request.setAttribute("message", "not find");
}
ServletContext application = this.getServletContext();
RequestDispatcher requestDispatcher = application.getRequestDispatcher("/HMS/admin/household_manage/search_householdresult.jsp");
requestDispatcher.forward(request, response);
}
public void addHouseholdMember(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {//家庭成员注册
int count = Integer.parseInt(request.getParameter("count"));//人数
String personal_id = request.getParameter("personal_id");
List<String> members_id = new ArrayList<>();
for(int i=0; i<count; i++) {
String id = "member_id"+i;//成员
members_id.add(request.getParameter(id));
}
IHouseholdService householdService = new HouseholdService();
Household household = householdService.findByPersonalId(personal_id);
if(household != null)
householdService.batchUpdateResidentHouseholdId(members_id, household);
searchHouseholdDetail(request, response);
}
public void searchHouseholdDetail(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//成员
String personal_id = request.getParameter("personal_id");
String iden = request.getParameter("iden");// 户主名或者集体名
if(iden != null)
personal_id = iden;
IHouseholdService householdService = new HouseholdService();
List<Resident> lists = householdService.searcHouseholdMember(personal_id);
IResidentService residentService = new ResidentService();
request.setAttribute("personal_id", personal_id);
request.setAttribute("personal_name", residentService.findById(personal_id).getName());
request.setAttribute("members", lists);
//地址
Household household = householdService.findByPersonalId(personal_id);
IAddressService addressService = new AddressService();
List<Address> addresses = addressService.findByHouseholdId(household.getHouseholder_id());
request.setAttribute("addresses", addresses);
//
request.setAttribute("message", "successfully");
ServletContext application = this.getServletContext();
RequestDispatcher requestDispatcher = application.getRequestDispatcher("/HMS/admin/household_manage/household_detail.jsp");
requestDispatcher.forward(request, response);
}
public void deleteHouseholdMember(HttpServletRequest request, HttpServletResponse response) throws ServletExcept
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本系统在开发时采用MVC设计模式和三层架构来进行开发设计。本考勤后台管理系统在设计上选择为B/S架构作为系统的基本架构,采用MVC设计模式和三层架构作为系统的开发基础[14]。B/S架构是目前最为流行的一种开发方式,它的主要特点就可以通过浏览器作为我们程序的客户端,减少对客户端机器运行的配置要求,减少客户端更新和维护的工作量,提升客户的整体体验[15]。MVC模式一种常用的软件设计模式,它主要通过控制器有效的对视图和模型进行隔离,降低开发过程中模型和视图耦合的情况,提升程序组件的可重用性。三层架构是一种常见的开发分层方法,通过视图层、业务层、持久层的分层设计,可以有效的提升程序的内聚性并降低组件之间的耦合性,从而有效的提升整体系统的灵活性和可扩展性[16]。本系统设计开发时使用JSP+Servlet+JDBC组合开发,由JSP作为视图层进行数据展示,Servlet作为控制层进行数据请求和响应的控制,由JDBC作为持久层操作MYSQL数据库进行数据的CRUD操作。
资源推荐
资源详情
资源评论
收起资源包目录
基于Javaweb实现户籍管理系统 (382个子文件)
DatePicker.class 13KB
DatePicker.class 13KB
HouseholdManage.class 12KB
HouseholdManage.class 12KB
UserManage.class 8KB
UserManage.class 8KB
ParentService.class 7KB
ParentService.class 7KB
ResidentManage.class 6KB
ResidentManage.class 6KB
BaseDAO.class 4KB
BaseDAO.class 4KB
HouseholdService.class 4KB
HouseholdService.class 4KB
LoginVaild.class 4KB
LoginVaild.class 4KB
Resident.class 4KB
Resident.class 4KB
RelationManage.class 4KB
RelationManage.class 4KB
CollectiveService.class 3KB
CollectiveService.class 3KB
Address.class 3KB
Address.class 3KB
AddressService.class 3KB
AddressService.class 3KB
HibernateSessionFactory.class 3KB
HibernateSessionFactory.class 3KB
UserService.class 3KB
UserService.class 3KB
test1.class 2KB
test1.class 2KB
DateUtil.class 2KB
DateUtil.class 2KB
DButil.class 2KB
DButil.class 2KB
BaseService.class 2KB
BaseService.class 2KB
exam.class 2KB
exam.class 2KB
EncodeFilter.class 2KB
EncodeFilter.class 2KB
Parent.class 1KB
Parent.class 1KB
ResidentService.class 1KB
ResidentService.class 1KB
Log.class 1KB
Log.class 1KB
SettingManage.class 1KB
SettingManage.class 1KB
User.class 1KB
User.class 1KB
DatePicker$7.class 1KB
DatePicker$7.class 1KB
Collective.class 992B
Collective.class 992B
Household.class 983B
Household.class 983B
DatePicker$8.class 976B
DatePicker$8.class 976B
SysSetting.class 956B
SysSetting.class 956B
servicetest.class 949B
servicetest.class 949B
DatePicker$3.class 918B
DatePicker$3.class 918B
DatePicker$6.class 877B
DatePicker$6.class 877B
loginvaild.class 874B
loginvaild.class 874B
IBaseService.class 790B
IBaseService.class 790B
IBaseDAO.class 778B
IHouseholdService.class 778B
IBaseDAO.class 778B
IHouseholdService.class 778B
DatePicker$2.class 775B
DatePicker$4.class 775B
DatePicker$2.class 775B
DatePicker$4.class 775B
DatePicker$1.class 774B
DatePicker$5.class 774B
DatePicker$1.class 774B
DatePicker$5.class 774B
ICollectiveService.class 765B
ICollectiveService.class 765B
SysSettingService.class 738B
SysSettingService.class 738B
LogService.class 675B
LogService.class 675B
IParentService.class 600B
IParentService.class 600B
IUserService.class 578B
IUserService.class 578B
IAddressService.class 572B
IAddressService.class 572B
SysSettingDAO.class 487B
CollectiveDAO.class 487B
SysSettingDAO.class 487B
CollectiveDAO.class 487B
共 382 条
- 1
- 2
- 3
- 4
资源评论
- weixin_440249662024-04-15资源很好用,有较大的参考价值,资源不错,支持一下。
编程指南针
- 粉丝: 6w+
- 资源: 214
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 校园失物招领网站:设计与实现的全流程解析
- 基于java的公司固定资产管理系统.doc
- 基于java+springboot+vue+mysql的学科竞赛管理系统 源码+数据库+论文(高分毕业设计).zip
- 人工智能领域计算断层成像技术研究最新进展综述
- 微藻检测10-YOLO(v5至v11)、COCO、CreateML、Paligemma、TFRecord、VOC数据集合集.rar
- 快速排序算法在Rust语言的实现及其优化
- 2024年超融合网络架构研究与实践报告.pdf
- 埃森哲:2024年360°价值报告(英文版).pdf
- ISACA中国社区2024女性职业现状调查报告.pdf
- 如何看待“适度宽松”的货币政策.pdf
- 双目立体匹配三维重建点云C++ 本工程基于网上开源代码进行修改,内容如下: 1.修改为 VS2015 Debug win32 版本,支持利用特征点和 OpenCV 立体匹配算法进行进行三维重建及显示
- 华为云AI数字人生态赋能千行百业高效发展.pdf
- 金融业数据安全发展与实践报告.pdf
- 候鸟生命线—共筑候鸟迁徙保护网络.pdf
- 2024年全国统一电力市场建设情况及展望报告.pdf
- 2018-2023年粤港澳、京津冀、长三角三大区域高校本科专业调整趋势.pdf
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功