Java?實戰(zhàn)項目之家政服務平臺系統(tǒng)的實現(xiàn)流程
一、項目簡述
功能包括: 家政服務網(wǎng)站系統(tǒng),用戶注冊,登錄,分為家政人員,普 通用戶,以及最高管理員,包括家政分類查詢,展示,線 上預約服務,家政申請,評論,留言溝通?,聯(lián)系家政服 務,家政人員的認證,職業(yè)認證,以及后臺的維護等等功能。
二、項目運行
環(huán)境配置: 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;
// 準備添加數(shù)據(jù)
@RequestMapping("/createUsers")
public String createUsers() {
return "admin/addusers";
}
// 添加數(shù)據(jù)
@RequestMapping("/addUsers")
public String addUsers(Users users) {
this.usersService.insertUsers(users);
return "redirect:/users/createUsers";
}
// 通過主鍵刪除數(shù)據(jù)
@RequestMapping("/deleteUsers")
public String deleteUsers(String id) {
this.usersService.deleteUsers(id);
return "redirect:/users/getAllUsers";
}
// 批量刪除數(shù)據(jù)
@RequestMapping("/deleteUsersByIds")
public String deleteUsersByIds() {
String[] ids = this.getRequest().getParameterValues("usersid");
for (String usersid : ids) {
this.usersService.deleteUsers(usersid);
}
return "redirect:/users/getAllUsers";
}
// 更新數(shù)據(jù)
@RequestMapping("/updateUsers")
public String updateUsers(Users users) {
this.usersService.updateUsers(users);
return "redirect:/users/getAllUsers";
}
// 顯示全部數(shù)據(jù)
@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";
}
// 按條件查詢數(shù)據(jù) (模糊查詢)
@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";
}
// 按主鍵查詢數(shù)據(jù)
@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;
// 準備添加數(shù)據(jù)
@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";
}
// 添加數(shù)據(jù)
@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";
}
// 通過主鍵刪除數(shù)據(jù)
@RequestMapping("/deleteTopic")
public String deleteTopic(String id) {
this.topicService.deleteTopic(id);
return "redirect:/topic/getAllTopic";
}
// 批量刪除數(shù)據(jù)
@RequestMapping("/deleteTopicByIds")
public String deleteTopicByIds() {
String[] ids = this.getRequest().getParameterValues("topicid");
for (String topicid : ids) {
this.topicService.deleteTopic(topicid);
}
return "redirect:/topic/getAllTopic";
}
// 更新數(shù)據(jù)
@RequestMapping("/updateTopic")
public String updateTopic(Topic topic) {
this.topicService.updateTopic(topic);
return "redirect:/topic/getAllTopic";
}
// 顯示全部數(shù)據(jù)
@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";
}
// 按條件查詢數(shù)據(jù) (模糊查詢)
@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";
}
// 按主鍵查詢數(shù)據(jù)
@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;
// 準備添加數(shù)據(jù)
@RequestMapping("/createOrders")
public String createOrders() {
List<Users> usersList = this.usersService.getAllUsers();
this.getRequest().setAttribute("usersList", usersList);
return "admin/addorders";
}
// 添加數(shù)據(jù)
@RequestMapping("/addOrders")
public String addOrders(Orders orders) {
this.ordersService.insertOrders(orders);
return "redirect:/orders/createOrders";
}
// 通過主鍵刪除數(shù)據(jù)
@RequestMapping("/deleteOrders")
public String deleteOrders(String id) {
this.ordersService.deleteOrders(id);
return "redirect:/orders/getAllOrders";
}
// 批量刪除數(shù)據(jù)
@RequestMapping("/deleteOrdersByIds")
public String deleteOrdersByIds() {
String[] ids = this.getRequest().getParameterValues("ordersid");
for (String ordersid : ids) {
this.ordersService.deleteOrders(ordersid);
}
return "redirect:/orders/getAllOrders";
}
// 更新數(shù)據(jù)
@RequestMapping("/updateOrders")
public String updateOrders(Orders orders) {
this.ordersService.updateOrders(orders);
return "redirect:/orders/getAllOrders";
}
// 顯示全部數(shù)據(jù)
@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";
}
// 按條件查詢數(shù)據(jù) (模糊查詢)
@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";
}
// 按主鍵查詢數(shù)據(jù)
@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;
}
}
數(shù)據(jù)圖表控制層:
//定義為控制器
@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 實戰(zhàn)項目之家政服務平臺系統(tǒng)的實現(xiàn)流程的文章就介紹到這了,更多相關Java 家政服務平臺系統(tǒng)內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!
- Java畢業(yè)設計實戰(zhàn)項目之寵物商城系統(tǒng)的實現(xiàn)流程
- Java畢業(yè)設計實戰(zhàn)項目之在線服裝銷售商城系統(tǒng)的實現(xiàn)流程
- Java畢業(yè)設計實戰(zhàn)項目之倉庫管理系統(tǒng)的實現(xiàn)流程
- Java實戰(zhàn)項目之校園跑腿管理系統(tǒng)的實現(xiàn)
- Java實戰(zhàn)項目練習之球館在線預約系統(tǒng)的實現(xiàn)
- Java?實戰(zhàn)項目之學生信息管理系統(tǒng)的實現(xiàn)流程
- Java 實戰(zhàn)項目之畢業(yè)設計管理系統(tǒng)的實現(xiàn)流程
- Java實例項目零錢通的實現(xiàn)流程
相關文章
SpringBoot中@EnableAutoConfiguration注解的實現(xiàn)
Spring Boot@EnableAutoConfiguration是一個強大的工具,可以簡化配置過程,從而實現(xiàn)快速開發(fā),本文主要介紹了SpringBoot中@EnableAutoConfiguration注解的實現(xiàn),感興趣的可以了解一下2024-01-01
詳解Java中字符串緩沖區(qū)StringBuffer類的使用
StringBuffer與String類似,只不過StringBuffer在進行字符串處理時不生成新的對象,下面我們就來詳解Java中字符串緩沖區(qū)StringBuffer類的使用:2016-06-06
Win10?IDEA如何連接虛擬機中的Hadoop(HDFS)
在虛擬機上配置Hadoop并修改core-site.xml文件,設置IP為局域網(wǎng)地址,IDEA中創(chuàng)建Maven項目,添加依賴,并檢查Hadoop重啟和端口轉發(fā),提供test.bat文件,通過修改IP簡化使用過程2024-11-11

