文末获取源码
开发语言:Java
框架:springboot
JDK版本:JDK1.8
服务器:tomcat7
数据库:mysql 5.7/8.0
数据库工具:Navicat11
开发软件:eclipse/myeclipse/idea
Maven包:Maven3.3.9
浏览器:谷歌浏览器
前言介绍
任何系统都要遵循系统设计的基本流程,本系统也不例外,同样需要经过市场调研,需求分析,概要设计,详细设计,编码,测试这些步骤,基于java技术、springboot框架、B/S机构、Mysql数据库设计并实现了私人健身与教练预约管理系统。
本系统主要包括管理员,用户和教练三个角色组成,主要包括以下功能:
(1)前台:首页、健身项目、教练信息、健身资讯、个人中心、后台管理 。
(2)管理员:首页、个人中心、用户管理、教练管理、健身项目管理、项目分类管理、教练信息管理、教练预约管理、系统管理。
(3)用户:首页、个人中心、教练预约管理。
(4)教练:首页、个人中心、教练信息管理、教练预约管理。
功能结构
为了更好的去理清本系统整体思路,对该系统以结构图的形式表达出来,设计实现该私人健身与教练预约管理系统的功能结构图如下所示:
系统功能模块
私人健身与教练预约管理系统,在系统首页可以查看首页,健身项目,教练信息,健身资讯,个人中心,后台管理等内容,并进行详细操作;如图
用户注册
在用户注册页面通过填写账号,密码,确认密码,姓名,手机,地址等信息进行注册操作,如图
健身项目
在健身项目页面可以查看项目名称,项目类型,健身效果,点击次数等内容,并进行收藏操作,如图
教练信息
个人中心
在个人中心页面通过填写账号,密码,姓名,性别,手机,地址,图片等内容进行更新信息操作,还可以进行我的收藏操作;如图
后台功能模块
后台登录,用户进入系统前在登录页面根据要求填写用户名和密码,选择角色等信息,点击登录进行登录操作,如图
管理员功能
管理员登录系统后,可以对首页,个人中心,用户管理,教练管理,健身项目管理,项目分类,教练信息管理,教练预约管理,系统管理等功能进行相应的操作,如图
用户管理
在用户管理页面可以对索引,账号,姓名,性别,手机,地址,图片等内容进行详情,修改和删除等操作,如图
教练管理
在教练管理页面可以对索引,教练编号,教练姓名,性别,年龄,教练等级,联系电话等信息进行详情,修改和删除等操作,如图
健身项目管理
在健身项目管理页面可以对索引,项目名称,项目类型,健身视频,项目图片等内容进行详情,修改,查看评论和删除等操作,如图
教练信息管理
在教练信息管理页面可以对索引,教练编号,教练姓名,性别,年龄,教练等级,联系电话,预约状态,教练图片等内容进行详情,查看评论和删除等操作;如图
教练预约管理
在教练预约管理页面可以对索引,教练编号,教练姓名,预约时间,预约说明,账号,姓名,手机,审核回复,审核状态等内容进行详情,删除操作;如图
用户功能
用户登录进入系统可以对首页,个人中心,教练预约管理等功能进行相应操作,如图
教练功能
教练登录进入系统可以对首页,个人中心,教练信息管理,教练预约管理等功能进行相应操作,如图
教练信息管理
在教练信息管理页面可以对索引,教练编号,教练姓名,性别,年龄,教练等级,联系电话,预约状态,教练图片等内容进行详情,查看评论和删除等操作;如图
部分核心代码
/**
* 教练预约
* 后端接口
* @author
* @email
* @date 2022-03-17 11:45:26
*/
@RestController
@RequestMapping("/jiaolianyuyue")
public class JiaolianyuyueController {
@Autowired
private JiaolianyuyueService jiaolianyuyueService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,JiaolianyuyueEntity jiaolianyuyue,
HttpServletRequest request){
String tableName = request.getSession().getAttribute("tableName").toString();
if(tableName.equals("jiaolian")) {
jiaolianyuyue.setJiaolianbianhao((String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
jiaolianyuyue.setZhanghao((String)request.getSession().getAttribute("username"));
}
EntityWrapper<JiaolianyuyueEntity> ew = new EntityWrapper<JiaolianyuyueEntity>();
PageUtils page = jiaolianyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiaolianyuyue), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params,JiaolianyuyueEntity jiaolianyuyue,
HttpServletRequest request){
EntityWrapper<JiaolianyuyueEntity> ew = new EntityWrapper<JiaolianyuyueEntity>();
PageUtils page = jiaolianyuyueService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, jiaolianyuyue), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( JiaolianyuyueEntity jiaolianyuyue){
EntityWrapper<JiaolianyuyueEntity> ew = new EntityWrapper<JiaolianyuyueEntity>();
ew.allEq(MPUtil.allEQMapPre( jiaolianyuyue, "jiaolianyuyue"));
return R.ok().put("data", jiaolianyuyueService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(JiaolianyuyueEntity jiaolianyuyue){
EntityWrapper< JiaolianyuyueEntity> ew = new EntityWrapper< JiaolianyuyueEntity>();
ew.allEq(MPUtil.allEQMapPre( jiaolianyuyue, "jiaolianyuyue"));
JiaolianyuyueView jiaolianyuyueView = jiaolianyuyueService.selectView(ew);
return R.ok("查询教练预约成功").put("data", jiaolianyuyueView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
JiaolianyuyueEntity jiaolianyuyue = jiaolianyuyueService.selectById(id);
return R.ok().put("data", jiaolianyuyue);
}
/**
* 前端详情
*/
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
JiaolianyuyueEntity jiaolianyuyue = jiaolianyuyueService.selectById(id);
return R.ok().put("data", jiaolianyuyue);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody JiaolianyuyueEntity jiaolianyuyue, HttpServletRequest request){
jiaolianyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiaolianyuyue);
jiaolianyuyueService.insert(jiaolianyuyue);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody JiaolianyuyueEntity jiaolianyuyue, HttpServletRequest request){
jiaolianyuyue.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(jiaolianyuyue);
jiaolianyuyueService.insert(jiaolianyuyue);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody JiaolianyuyueEntity jiaolianyuyue, HttpServletRequest request){
//ValidatorUtils.validateEntity(jiaolianyuyue);
jiaolianyuyueService.updateById(jiaolianyuyue);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
jiaolianyuyueService.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<JiaolianyuyueEntity> wrapper = new EntityWrapper<JiaolianyuyueEntity>();
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("jiaolian")) {
wrapper.eq("jiaolianbianhao", (String)request.getSession().getAttribute("username"));
}
if(tableName.equals("yonghu")) {
wrapper.eq("zhanghao", (String)request.getSession().getAttribute("username"));
}
int count = jiaolianyuyueService.selectCount(wrapper);
return R.ok().put("count", count);
}
}
/**
* 上传文件映射表
*/
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
@Autowired
private ConfigService configService;
/**
* 上传文件
*/
@RequestMapping("/upload")
public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
if (file.isEmpty()) {
throw new EIException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/upload/");
if(!upload.exists()) {
upload.mkdirs();
}
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(upload.getAbsolutePath()+"/"+fileName);
file.transferTo(dest);
/**
* 如果使用idea或者eclipse重启项目,发现之前上传的图片或者文件丢失,将下面一行代码注释打开
* 请将以下的"D:\\springbootq33sd\\src\\main\\resources\\static\\upload"替换成你本地项目的upload路径,
* 并且项目路径不能存在中文、空格等特殊字符
*/
// FileUtils.copyFile(dest, new File("D:\\springbootq33sd\\src\\main\\resources\\static\\upload"+"/"+fileName)); /**修改了路径以后请将该行最前面的//注释去掉**/
if(StringUtils.isNotBlank(type) && type.equals("1")) {
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
if(configEntity==null) {
configEntity = new ConfigEntity();
configEntity.setName("faceFile");
configEntity.setValue(fileName);
} else {
configEntity.setValue(fileName);
}
configService.insertOrUpdate(configEntity);
}
return R.ok().put("file", fileName);
}
/**
* 下载文件
*/
@IgnoreAuth
@RequestMapping("/download")
public ResponseEntity<byte[]> download(@RequestParam String fileName) {
try {
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/upload/");
if(!upload.exists()) {
upload.mkdirs();
}
File file = new File(upload.getAbsolutePath()+"/"+fileName);
if(file.exists()){
/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
getResponse().sendError(403);
}*/
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", fileName);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
} catch (IOException e) {
e.printStackTrace();
}
return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}