欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Java 实战项目之家政服务平台系统的实现流程

程序员文章站 2022-07-02 09:08:39
一、项目简述功能包括: 家政服务网站系统,用户注册,登录,分为家政人员,普 通用户,以及最高管理员,包括家政分类查询,展示,线 上预约服务,家政申请,评论,留言沟通・,联系家政服 务,家政人员的认证,...

一、项目简述

功能包括: 家政服务网站系统,用户注册,登录,分为家政人员,普 通用户,以及最高管理员,包括家政分类查询,展示,线 上预约服务,家政申请,评论,留言沟通・,联系家政服 务,家政人员的认证,职业认证,以及后台的维护等等功能。

二、项目运行

环境配置: jdk1.8 + tomcat8.5 + mysql + eclispe (intellij idea,eclispe,myeclispe,sts 都支持)

项目技术: jsp +spring + springmvc + mybatis + html+ css + javascript + jquery + ajax + maven等等。

Java 实战项目之家政服务平台系统的实现流程

Java 实战项目之家政服务平台系统的实现流程

Java 实战项目之家政服务平台系统的实现流程

Java 实战项目之家政服务平台系统的实现流程

Java 实战项目之家政服务平台系统的实现流程

用户信息控制层:

//定义为控制器
@controller
// 设置路径
@requestmapping(value = "/users", produces = "text/plain;charset=utf-8")
public class userscontroller extends basecontroller {
	// 注入service 由于标签的存在 所以不需要getter setter
	@autowired
	@resource
	private usersservice usersservice;
 
	// 准备添加数据
	@requestmapping("/createusers")
	public string createusers() {
		return "admin/addusers";
	}
 
	// 添加数据
	@requestmapping("/addusers")
	public string addusers(users users) {
		this.usersservice.insertusers(users);
		return "redirect:/users/createusers";
	}
 
	// 通过主键删除数据
	@requestmapping("/deleteusers")
	public string deleteusers(string id) {
		this.usersservice.deleteusers(id);
		return "redirect:/users/getallusers";
	}
 
	// 批量删除数据
	@requestmapping("/deleteusersbyids")
	public string deleteusersbyids() {
		string[] ids = this.getrequest().getparametervalues("usersid");
		for (string usersid : ids) {
			this.usersservice.deleteusers(usersid);
		}
		return "redirect:/users/getallusers";
	}
 
	// 更新数据
	@requestmapping("/updateusers")
	public string updateusers(users users) {
		this.usersservice.updateusers(users);
		return "redirect:/users/getallusers";
	}
 
	// 显示全部数据
	@requestmapping("/getallusers")
	public string getallusers(string number) {
		list<users> userslist = this.usersservice.getallusers();
		pagehelper.getpage(userslist, "users", null, null, 10, number, this.getrequest(), null);
		return "admin/listusers";
	}
 
	// 按条件查询数据 (模糊查询)
	@requestmapping("/queryusersbycond")
	public string queryusersbycond(string cond, string name, string number) {
		users users = new users();
		if (cond != null) {
			if ("username".equals(cond)) {
				users.setusername(name);
			}
			if ("password".equals(cond)) {
				users.setpassword(name);
			}
			if ("realname".equals(cond)) {
				users.setrealname(name);
			}
			if ("sex".equals(cond)) {
				users.setsex(name);
			}
			if ("birthday".equals(cond)) {
				users.setbirthday(name);
			}
			if ("contact".equals(cond)) {
				users.setcontact(name);
			}
			if ("regdate".equals(cond)) {
				users.setregdate(name);
			}
		}
 
		list<string> namelist = new arraylist<string>();
		list<string> valuelist = new arraylist<string>();
		namelist.add(cond);
		valuelist.add(name);
		pagehelper.getpage(this.usersservice.getusersbylike(users), "users", namelist, valuelist, 10, number, this.getrequest(), "query");
		name = null;
		cond = null;
		return "admin/queryusers";
	}
 
	// 按主键查询数据
	@requestmapping("/getusersbyid")
	public string getusersbyid(string id) {
		users users = this.usersservice.getusersbyid(id);
		this.getrequest().setattribute("users", users);
		return "admin/editusers";
	}
 
	public usersservice getusersservice() {
		return usersservice;
	}
 
	public void setusersservice(usersservice usersservice) {
		this.usersservice = usersservice;
	}
 
}

标签增删改查:

//定义为控制器
@controller
// 设置路径
@requestmapping(value = "/topic", produces = "text/plain;charset=utf-8")
public class topiccontroller extends basecontroller {
	// 注入service 由于标签的存在 所以不需要getter setter
	@autowired
	@resource
	private topicservice topicservice;
	@autowired
	@resource
	private usersservice usersservice;
	@autowired
	@resource
	private ordersservice ordersservice;
	@autowired
	@resource
	private goodsservice goodsservice;
 
	// 准备添加数据
	@requestmapping("/createtopic")
	public string createtopic() {
		list<users> userslist = this.usersservice.getallusers();
		this.getrequest().setattribute("userslist", userslist);
		list<orders> orderslist = this.ordersservice.getallorders();
		this.getrequest().setattribute("orderslist", orderslist);
		list<goods> goodslist = this.goodsservice.getallgoods();
		this.getrequest().setattribute("goodslist", goodslist);
		return "admin/addtopic";
	}
 
	// 添加数据
	@requestmapping("/addtopic")
	public string addtopic(topic topic) {
		topic.setusersid("");
		topic.setordersid("");
		topic.setgoodsid("");
		topic.setnum("");
		topic.setaddtime(vedate.getstringdateshort());
		topic.setstatus("");
		this.topicservice.inserttopic(topic);
		return "redirect:/topic/createtopic";
	}
 
	// 通过主键删除数据
	@requestmapping("/deletetopic")
	public string deletetopic(string id) {
		this.topicservice.deletetopic(id);
		return "redirect:/topic/getalltopic";
	}
 
	// 批量删除数据
	@requestmapping("/deletetopicbyids")
	public string deletetopicbyids() {
		string[] ids = this.getrequest().getparametervalues("topicid");
		for (string topicid : ids) {
			this.topicservice.deletetopic(topicid);
		}
		return "redirect:/topic/getalltopic";
	}
 
	// 更新数据
	@requestmapping("/updatetopic")
	public string updatetopic(topic topic) {
		this.topicservice.updatetopic(topic);
		return "redirect:/topic/getalltopic";
	}
 
	// 显示全部数据
	@requestmapping("/getalltopic")
	public string getalltopic(string number) {
		list<topic> topiclist = this.topicservice.getalltopic();
		pagehelper.getpage(topiclist, "topic", null, null, 10, number, this.getrequest(), null);
		return "admin/listtopic";
	}
 
	// 按条件查询数据 (模糊查询)
	@requestmapping("/querytopicbycond")
	public string querytopicbycond(string cond, string name, string number) {
		topic topic = new topic();
		if (cond != null) {
			if ("usersid".equals(cond)) {
				topic.setusersid(name);
			}
			if ("ordersid".equals(cond)) {
				topic.setordersid(name);
			}
			if ("goodsid".equals(cond)) {
				topic.setgoodsid(name);
			}
			if ("num".equals(cond)) {
				topic.setnum(name);
			}
			if ("contents".equals(cond)) {
				topic.setcontents(name);
			}
			if ("addtime".equals(cond)) {
				topic.setaddtime(name);
			}
			if ("status".equals(cond)) {
				topic.setstatus(name);
			}
			if ("reps".equals(cond)) {
				topic.setreps(name);
			}
		}
 
		list<string> namelist = new arraylist<string>();
		list<string> valuelist = new arraylist<string>();
		namelist.add(cond);
		valuelist.add(name);
		pagehelper.getpage(this.topicservice.gettopicbylike(topic), "topic", namelist, valuelist, 10, number, this.getrequest(), "query");
		name = null;
		cond = null;
		return "admin/querytopic";
	}
 
	// 按主键查询数据
	@requestmapping("/gettopicbyid")
	public string gettopicbyid(string id) {
		topic topic = this.topicservice.gettopicbyid(id);
		this.getrequest().setattribute("topic", topic);
		list<users> userslist = this.usersservice.getallusers();
		this.getrequest().setattribute("userslist", userslist);
		list<orders> orderslist = this.ordersservice.getallorders();
		this.getrequest().setattribute("orderslist", orderslist);
		list<goods> goodslist = this.goodsservice.getallgoods();
		this.getrequest().setattribute("goodslist", goodslist);
		return "admin/edittopic";
	}
 
	public topicservice gettopicservice() {
		return topicservice;
	}
 
	public void settopicservice(topicservice topicservice) {
		this.topicservice = topicservice;
	}
 
}

订单控制层:

//定义为控制器
@controller
// 设置路径
@requestmapping(value = "/orders", produces = "text/plain;charset=utf-8")
public class orderscontroller extends basecontroller {
	// 注入service 由于标签的存在 所以不需要getter setter
	@autowired
	@resource
	private ordersservice ordersservice;
	@autowired
	@resource
	private usersservice usersservice;
 
	// 准备添加数据
	@requestmapping("/createorders")
	public string createorders() {
		list<users> userslist = this.usersservice.getallusers();
		this.getrequest().setattribute("userslist", userslist);
		return "admin/addorders";
	}
 
	// 添加数据
	@requestmapping("/addorders")
	public string addorders(orders orders) {
		this.ordersservice.insertorders(orders);
		return "redirect:/orders/createorders";
	}
 
	// 通过主键删除数据
	@requestmapping("/deleteorders")
	public string deleteorders(string id) {
		this.ordersservice.deleteorders(id);
		return "redirect:/orders/getallorders";
	}
 
	// 批量删除数据
	@requestmapping("/deleteordersbyids")
	public string deleteordersbyids() {
		string[] ids = this.getrequest().getparametervalues("ordersid");
		for (string ordersid : ids) {
			this.ordersservice.deleteorders(ordersid);
		}
		return "redirect:/orders/getallorders";
	}
 
	// 更新数据
	@requestmapping("/updateorders")
	public string updateorders(orders orders) {
		this.ordersservice.updateorders(orders);
		return "redirect:/orders/getallorders";
	}
 
	// 显示全部数据
	@requestmapping("/getallorders")
	public string getallorders(string number) {
		list<orders> orderslist = this.ordersservice.getallorders();
		pagehelper.getpage(orderslist, "orders", null, null, 10, number, this.getrequest(), null);
		return "admin/listorders";
	}
 
	// 按条件查询数据 (模糊查询)
	@requestmapping("/queryordersbycond")
	public string queryordersbycond(string cond, string name, string number) {
		orders orders = new orders();
		if (cond != null) {
			if ("ordercode".equals(cond)) {
				orders.setordercode(name);
			}
			if ("usersid".equals(cond)) {
				orders.setusersid(name);
			}
			if ("total".equals(cond)) {
				orders.settotal(name);
			}
			if ("addtime".equals(cond)) {
				orders.setaddtime(name);
			}
			if ("status".equals(cond)) {
				orders.setstatus(name);
			}
			if ("address".equals(cond)) {
				orders.setaddress(name);
			}
			if ("contact".equals(cond)) {
				orders.setcontact(name);
			}
			if ("workdate".equals(cond)) {
				orders.setworkdate(name);
			}
			if ("worktime".equals(cond)) {
				orders.setworktime(name);
			}
		}
 
		list<string> namelist = new arraylist<string>();
		list<string> valuelist = new arraylist<string>();
		namelist.add(cond);
		valuelist.add(name);
		pagehelper.getpage(this.ordersservice.getordersbylike(orders), "orders", namelist, valuelist, 10, number, this.getrequest(), "query");
		name = null;
		cond = null;
		return "admin/queryorders";
	}
 
	// 按主键查询数据
	@requestmapping("/getordersbyid")
	public string getordersbyid(string id) {
		orders orders = this.ordersservice.getordersbyid(id);
		this.getrequest().setattribute("orders", orders);
		list<users> userslist = this.usersservice.getallusers();
		this.getrequest().setattribute("userslist", userslist);
		return "admin/editorders";
	}
 
	public ordersservice getordersservice() {
		return ordersservice;
	}
 
	public void setordersservice(ordersservice ordersservice) {
		this.ordersservice = ordersservice;
	}
 
}

数据图表控制层:

//定义为控制器
@controller
// 设置路径
@requestmapping(value = "/chart", produces = "text/plain;charset=utf-8")
public class chartcontroller extends basecontroller {
	@autowired
	@resource
	private ordersservice ordersservice;
	@autowired
	@resource
	private cateservice cateservice;
	@autowired
	@resource
	private goodsservice goodsservice;
	@autowired
	@resource
	private topicservice topicservice;
 
	@requestmapping("/chartline")
	@responsebody
	public string chartline() throws jsonexception {
		string start = this.getrequest().getparameter("start");
		string end = this.getrequest().getparameter("end");
		long days = vedate.getdays(end, start) + 1;
		jsonarray count = new jsonarray();
		jsonarray day = new jsonarray(); // 存放名称
		for (int i = 0; i < days; i++) {
			string nxtday = vedate.getnextday(start, "" + i);
			double total = 0;
			orders orders = new orders();
			orders.setaddtime(nxtday);
			list<orders> list = this.ordersservice.getordersbycond(orders);
			for (orders b : list) {
				total += double.parsedouble(b.gettotal());
			}
			count.put(total);
			day.put(nxtday);
		}
		jsonobject json = new jsonobject();
		json.put("count", count.tostring());
		json.put("days", day.tostring().replaceall("\"", ""));
		return json.tostring();
	}
 
	@requestmapping("/chartpie")
	@responsebody
	public string chartpie() throws jsonexception {
		jsonarray count = new jsonarray();
		jsonarray name = new jsonarray(); // 存放名称
		list<goods> goodslist = this.goodsservice.getallgoods();
		for (goods goods : goodslist) {
			name.put(goods.getgoodsname());
			count.put(integer.parseint(goods.getsellnum()));
		}
		jsonobject json = new jsonobject();
		json.put("count", count.tostring());
		json.put("names", name.tostring().replaceall("\"", ""));
		return json.tostring();
	}
 
	@requestmapping("/chartbar")
	@responsebody
	public string chartbar() throws jsonexception {
		jsonarray name = new jsonarray();
		jsonarray count = new jsonarray();
		list<cate> catelist = this.cateservice.getallcate();
		for (cate cate : catelist) {
			name.put(cate.getcatename());
			int sum1 = 0;
			int sum2 = 0;
			int sum3 = 0;
			int sum4 = 0;
			int sum5 = 0;
			topic t = new topic();
			t.setcateid(cate.getcateid());
			list<topic> list = this.topicservice.gettopicbar(t);
			for (topic x : list) {
				if (integer.parseint(x.getnum()) == 1) {
					sum1++;
				}
				if (integer.parseint(x.getnum()) == 2) {
					sum2++;
				}
				if (integer.parseint(x.getnum()) == 3) {
					sum3++;
				}
				if (integer.parseint(x.getnum()) == 4) {
					sum4++;
				}
				if (integer.parseint(x.getnum()) == 5) {
					sum5++;
				}
			}
			string sum = "" + sum1 + ";" + sum2 + ";" + sum3 + ";" + sum4 + ";" + sum5;
			system.out.println(sum);
			count.put(sum);
		}
		jsonobject json = new jsonobject();
		json.put("count", count.tostring().replaceall("\"", ""));
		json.put("names", name.tostring().replaceall("\"", ""));
		return json.tostring();
	}
}

到此这篇关于java 实战项目之家政服务平台系统的实现流程的文章就介绍到这了,更多相关java 家政服务平台系统内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!