随着家政服务行业的不断发展,家政服务在现实生活中的使用和普及,家政服务行业成为近年内出现的一个新行业,并且能够成为大众广为认可和接受的行为和选择。设计家政服务管理平台的目的就是借助计算机让复杂的销售操作变简单,变高效。
家政服务管理平台采用了B/S结构,JAVA作为开发语言,数据库采用了B/S结构,Mysql数据库进行开发。该系统包括前台操作和后台管理两个部分,一方面,为用户提供首页、服务信息、公告信息、留言反馈、个人中心、后台管理等功能;另一方面,为管理员提供首页、个人中心、用户管理、服务人员管理、服务信息管理、服务类型管理、服务预约管理、服务取消管理、服务分配管理、服务进度管理、评价信息管理、留言反馈、系统管理等功能。
【关键词】家政服务;JAVA;B/S结构
基于springboot家政服务管理平台源码和论文328
Abstract
With the continuous development of the homemaking service industry, the use and popularity of homemaking service in real life has become a new industry in recent years, and can become a widely recognized and accepted behavior and choice of the public. The purpose of designing housekeeping service management platform is to make the complicated sales operation simple and efficient with the help of computer.
Housekeeping service management platform uses B/S structure, JAVA as the development language, database uses B/S structure, Mysql database for development. The system includes two parts of foreground operation and background management. On the one hand, it provides users with home page, service information, announcement information, message feedback, personal center, background management and other functions. On the other hand, it provides administrators with home page, personal center, user management, service personnel management, service information management, service type management, service reservation management, service cancellation management, service allocation management, service progress management, evaluation information management, message feedback, system management and other functions.
【 Key words 】 Housekeeping service; JAVA; B/S structure
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.FuwuyuyueEntity;
import com.entity.view.FuwuyuyueView;
import com.service.FuwuyuyueService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 服务预约
* 后端接口
* @author
* @email
* @date 2022-05-07 10:17:53
*/
@RestController
@RequestMapping("/fuwuyuyue")
public class FuwuyuyueController {
@Autowired
private FuwuyuyueService fuwuyuyueService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,FuwuyuyueEntity fuwuyuyue,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
fuwuyuyue.setZhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<FuwuyuyueEntity> ew = new EntityWrapper<FuwuyuyueEntity>();
PageUtils page = fuwuyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, fuwuyuyue), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,FuwuyuyueEntity fuwuyuyue,
HttpServletRequest request){
EntityWrapper<FuwuyuyueEntity> ew = new EntityWrapper<FuwuyuyueEntity>();
PageUtils page = fuwuyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, fuwuyuyue), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( FuwuyuyueEntity fuwuyuyue){
EntityWrapper<FuwuyuyueEntity> ew = new EntityWrapper<FuwuyuyueEntity>();
ew.allEq(MPUtil.allEQMapPre( fuwuyuyue, "fuwuyuyue"));
return R.ok().put("data", fuwuyuyueService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(FuwuyuyueEntity fuwuyuyue){
EntityWrapper< FuwuyuyueEntity> ew = new EntityWrapper< FuwuyuyueEntity>();
ew.allEq(MPUtil.allEQMapPre( fuwuyuyue, "fuwuyuyue"));
FuwuyuyueView fuwuyuyueView = fuwuyuyueService.selectView(ew);
return R.ok("查询服务预约成功").put("data", fuwuyuyueView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
FuwuyuyueEntity fuwuyuyue = fuwuyuyueService.selectById(id);
return R.ok().put("data", fuwuyuyue);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
FuwuyuyueEntity fuwuyuyue = fuwuyuyueService.selectById(id);
return R.ok().put("data", fuwuyuyue);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody FuwuyuyueEntity fuwuyuyue, HttpServletRequest request){
fuwuyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(fuwuyuyue);
fuwuyuyueService.insert(fuwuyuyue);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody FuwuyuyueEntity fuwuyuyue, HttpServletRequest request){
fuwuyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(fuwuyuyue);
fuwuyuyueService.insert(fuwuyuyue);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody FuwuyuyueEntity fuwuyuyue, HttpServletRequest request){
//ValidatorUtils.validateEntity(fuwuyuyue);
fuwuyuyueService.updateById(fuwuyuyue);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
fuwuyuyueService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<FuwuyuyueEntity> wrapper = new EntityWrapper<FuwuyuyueEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
int count = fuwuyuyueService.selectCount(wrapper);
return R.ok().put("count", count);
}
/**
* (按值统计)
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}")
public R value(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
EntityWrapper<FuwuyuyueEntity> ew = new EntityWrapper<FuwuyuyueEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = fuwuyuyueService.selectValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* (按值统计)时间统计类型
*/
@RequestMapping("/value/{xColumnName}/{yColumnName}/{timeStatType}")
public R valueDay(@PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName, @PathVariable("timeStatType") String timeStatType,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
params.put("timeStatType", timeStatType);
EntityWrapper<FuwuyuyueEntity> ew = new EntityWrapper<FuwuyuyueEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = fuwuyuyueService.selectTimeStatValue(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
/**
* 分组统计
*/
@RequestMapping("/group/{columnName}")
public R group(@PathVariable("columnName") String columnName,HttpServletRequest request) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("column", columnName);
EntityWrapper<FuwuyuyueEntity> ew = new EntityWrapper<FuwuyuyueEntity>();
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("yonghu")) {
ew.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
List<Map<String, Object>> result = fuwuyuyueService.selectGroup(params, ew);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
for(Map<String, Object> m : result) {
for(String k : m.keySet()) {
if(m.get(k) instanceof Date) {
m.put(k, sdf.format((Date)m.get(k)));
}
}
}
return R.ok().put("data", result);
}
}
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.FuwurenyuanEntity;
import com.entity.view.FuwurenyuanView;
import com.service.FuwurenyuanService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.CommonUtil;
import java.io.IOException;
/**
* 服务人员
* 后端接口
* @author
* @email
* @date 2022-05-07 10:17:53
*/
@RestController
@RequestMapping("/fuwurenyuan")
public class FuwurenyuanController {
@Autowired
private FuwurenyuanService fuwurenyuanService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
FuwurenyuanEntity user = fuwurenyuanService.selectOne(new EntityWrapper<FuwurenyuanEntity>().eq("gonghao", username));
if(user==null || !user.getMima().equals(password)) {
return R.error("账号或密码不正确");
}
String token = tokenService.generateToken(user.getId(), username,"fuwurenyuan", "服务人员" );
return R.ok().put("token", token);
}
/**
* 注册
*/
@IgnoreAuth
@RequestMapping("/register")
public R register(@RequestBody FuwurenyuanEntity fuwurenyuan){
//ValidatorUtils.validateEntity(fuwurenyuan);
FuwurenyuanEntity user = fuwurenyuanService.selectOne(new EntityWrapper<FuwurenyuanEntity>().eq("gonghao", fuwurenyuan.getGonghao()));
if(user!=null) {
return R.error("注册用户已存在");
}
Long uId = new Date().getTime();
fuwurenyuan.setId(uId);
fuwurenyuanService.insert(fuwurenyuan);
return R.ok();
}
/**
* 退出
*/
@RequestMapping("/logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
}
/**
* 获取用户的session用户信息
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Long id = (Long)request.getSession().getAttribute("userId");
FuwurenyuanEntity user = fuwurenyuanService.selectById(id);
return R.ok().put("data", user);
}
/**
* 密码重置
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request){
FuwurenyuanEntity user = fuwurenyuanService.selectOne(new EntityWrapper<FuwurenyuanEntity>().eq("gonghao", username));
if(user==null) {
return R.error("账号不存在");
}
user.setMima("123456");
fuwurenyuanService.updateById(user);
return R.ok("密码已重置为:123456");
}
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,FuwurenyuanEntity fuwurenyuan,
HttpServletRequest request){
EntityWrapper<FuwurenyuanEntity> ew = new EntityWrapper<FuwurenyuanEntity>();
PageUtils page = fuwurenyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, fuwurenyuan), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,FuwurenyuanEntity fuwurenyuan,
HttpServletRequest request){
EntityWrapper<FuwurenyuanEntity> ew = new EntityWrapper<FuwurenyuanEntity>();
PageUtils page = fuwurenyuanService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, fuwurenyuan), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( FuwurenyuanEntity fuwurenyuan){
EntityWrapper<FuwurenyuanEntity> ew = new EntityWrapper<FuwurenyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( fuwurenyuan, "fuwurenyuan"));
return R.ok().put("data", fuwurenyuanService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(FuwurenyuanEntity fuwurenyuan){
EntityWrapper< FuwurenyuanEntity> ew = new EntityWrapper< FuwurenyuanEntity>();
ew.allEq(MPUtil.allEQMapPre( fuwurenyuan, "fuwurenyuan"));
FuwurenyuanView fuwurenyuanView = fuwurenyuanService.selectView(ew);
return R.ok("查询服务人员成功").put("data", fuwurenyuanView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
FuwurenyuanEntity fuwurenyuan = fuwurenyuanService.selectById(id);
return R.ok().put("data", fuwurenyuan);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
FuwurenyuanEntity fuwurenyuan = fuwurenyuanService.selectById(id);
return R.ok().put("data", fuwurenyuan);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody FuwurenyuanEntity fuwurenyuan, HttpServletRequest request){
fuwurenyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(fuwurenyuan);
FuwurenyuanEntity user = fuwurenyuanService.selectOne(new EntityWrapper<FuwurenyuanEntity>().eq("gonghao", fuwurenyuan.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
fuwurenyuan.setId(new Date().getTime());
fuwurenyuanService.insert(fuwurenyuan);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody FuwurenyuanEntity fuwurenyuan, HttpServletRequest request){
fuwurenyuan.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(fuwurenyuan);
FuwurenyuanEntity user = fuwurenyuanService.selectOne(new EntityWrapper<FuwurenyuanEntity>().eq("gonghao", fuwurenyuan.getGonghao()));
if(user!=null) {
return R.error("用户已存在");
}
fuwurenyuan.setId(new Date().getTime());
fuwurenyuanService.insert(fuwurenyuan);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@Transactional
public R update(@RequestBody FuwurenyuanEntity fuwurenyuan, HttpServletRequest request){
//ValidatorUtils.validateEntity(fuwurenyuan);
fuwurenyuanService.updateById(fuwurenyuan);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
fuwurenyuanService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
/**
* 提醒接口
*/
@RequestMapping("/remind/{columnName}/{type}")
public R remindCount(@PathVariable("columnName") String columnName, HttpServletRequest request,
@PathVariable("type") String type,@RequestParam Map<String, Object> map) {
map.put("column", columnName);
map.put("type", type);
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
map.put("remindstart", sdf.format(remindStartDate));
}
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
map.put("remindend", sdf.format(remindEndDate));
}
}
Wrapper<FuwurenyuanEntity> wrapper = new EntityWrapper<FuwurenyuanEntity>();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
int count = fuwurenyuanService.selectCount(wrapper);
return R.ok().put("count", count);
}
}