目录
大家好呀,我是一个混迹在java圈的码农。今天要和大家分享的是 一款基于SpringBoot+Vue“智慧食堂”的设计与实现,项目源码请点击文章末尾联系我哦~
目前有各类成品 毕设 JavaWeb SSM SpringBoot等等项目框架,源码丰富,欢迎咨询。
一、项目介绍
该系统的应用可以减少工作人员的劳动强度,提高工作效率与管理水平,具有很大的价值。它可以使“智慧食堂”系统操作简单,成功率高,使网上“智慧食堂”系统的管理向一个更高层次前进。
本系统尝试使用springboot在网上架构一个动态的“智慧食堂”系统,以使每一用户在家就能通过系统来进行“智慧食堂”系统管理。
关键词:“智慧食堂”系统; springboot;mysql数据库
二、开发环境
开发系统:Windows
JDK版本:Java JDK1.8(推荐)
开发工具:IDEA/MyEclipse(推荐IDEA)
数据库版本: mysql8.0(推荐)
数据库可视化工具: navicat
服务器:SpringBoot自带 apache tomcat
框架:springboot,vue
三、功能介绍
系统总体设计即对有关系统全局问题的设计,也就是设计系统总的处理方案,又称系统概要设计。它包括系统规划与系统功能设计等内容。
“智慧食堂”系统主要有两类用户。分别是用户模块和管理员模块。系统登陆: 运行系统,首先进入登录界面,按照登录界面的要求填写相应的“用户名”和“密码”以及用户类型,点击“登录”然后系统判断填写是否正确,若正确进入相应的界面,否则给出要求先注册信息。在系统首页可以查看首页,菜品信息,留言板,个人中心,购物车等内容进行详细操作。管理员登录系统后,可以对首页,个人中心,用户管理,菜品分类管理,菜品信息管理,留言板管理,系统管理,订单管理等功能进行相应操作。
四、核心代码
@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);
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);
}
五、效果图
六、源码获取:
👇🏻获取联系方式在文章末尾👇🏻
有需要的伙伴可以点击下方名片,与我联系哦~