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

一、项目简述

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

二、项目运行

环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + maven等等。

用户信息控制层:

//定义为控制器
@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 家政服务平台系统内容请搜索我们以前的文章或继续浏览下面的相关文章希望大家以后多多支持我们!

(0)

相关推荐

  • Java 实战项目基于遗传算法学校排课系统的实现流程

    一.项目简述 本系统功能包括: 排课管理,课程管理,讲师管理,班级管理,学生管理,教学资料,学习文档,在线测试,教材列表,教学设计,帮助中心等等功能. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持). 项目技术: Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理

  • Java 实战练手项目之酒店管理系统的实现流程

    一.项目简述 功能包括(管理员和用户角色): 酒店预订,酒店管理,员工管理,入住原理,订单管理, 楼层管理,退房管理,营业额报表等等. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+

  • Java 实战练手项目之医院预约挂号系统的实现流程

    一.项目简述 功能: 用户分为患者,医生,管理员,患者可进行注册选择医生 挂号,选择日期,选择号源,医生可进行接诊,管理员可 对用户,医生信息的维护等等功能. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: Jdbc+ Servlert + Jsp + css + JavaScript + JQuery + Ajax + Fileupload等等.

  • Java 实战项目之在线点餐系统的实现流程

    一.项目简述 功能包括: 在线点餐,评论,购物车,下单,支付,管理员,店家多 商家管理,后台评论管理,订单管理,商品管理等等. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ mave

  • Java 实战练手项目之校园超市管理系统的实现流程

    前端模板框架为Bootstrap,系统分为前台和后台.后台主要为管理员角色,功能有:商品类型管理.商品管理.订单管理.会员管理.管理员管理等.前台用户功能有:登录.注册.查看商品.加入购物车.付款.查看订单.个人中心等.该系统总共9张表 运行环境:windows/linux.jdk1.8.mysql5.x.maven3.5\3.6.tomcat7.0 前端商品控制器: /** * <p> * 前端控制器 * </p> */ @RestController @RequestMappi

  • Java 实战项目之诚途旅游系统的实现流程

    采用ssm架构实现的旅游网站系统 包括网站展示和后台管理功能,网站主要是页面浏览以及评论.制定旅游方案.智能推荐功能 后台就是维护网站展示的内容,添加旅游景点.管理用户.查看用户的搜索记录功能 酒店信息控制层: /** * 控制器层 * */ @Controller @CrossOrigin @RequestMapping("/hotel") public class HotelController { @Autowired private HotelService hotelServ

  • Java 实战项目之精品养老院管理系统的实现流程

    一.项目简述 本系统功能包括:通知公告,老人管理,护工管理,问答管理等等功能. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持). 项目技术: Springboot + Maven + mybatis+ Vue 等等组成,B/S模式 + Maven管理等等. 系统控制器(登录.注销.修改.新增登)业务: /** * 系统控

  • Java 实战项目锤炼之嘟嘟健身房管理系统的实现流程

    一.项目简述 功能包括: 前台+后台健身房管理系统,用户预订,教练选择.课程选 择,登录,后台管理等等. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等. 系统操作模块

  • Java 实战项目之CRM客户管理系统的实现流程

    一.项目简述 功能包括: 用户管理,系统管理,客户管理,客户服务,客户关怀, 销售机会,统计管理等等. 二.项目运行 环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等. 员工操作: /

  • Java 实战项目之精美物流管理系统的实现流程

    一.项目简述 本系统功能包括: 数据统计.收件录入.发件录入.到件录入.派件录入.问题件录入.退件录入.留仓录入.装车录入.发车录入.到车录入.卸车录入.运单录入.运单编辑.运单查询.数据导入.签收录入.签收查询.快件跟踪.自定义跟踪.问题件跟踪.预付款管理.财务报表明细.现金账单.月结账单.代收货款.业务员提成.订单分配.订单查询.物品名维护.入库.出库.库存.物料.角色管理.用户管理.系统设置.员工维护.客户维护.网点维护.报价维护.其他维护.收发记录.到件预报. 二.项目运行 环境配置:

随机推荐