JSP水果管理系统源码(水果进销存管理系统水果管理系统(水果进销存)
常见的Javaweb题材有
理财系统,就业管理系统,汽车租赁,简易网盘,疫情数据查看,在线招标房,屋租赁,教务管理,医院管理,餐厅收银,来访咨询,兼职论坛,桌面聊天室,酒店管理,民宿管理,车位租赁,音乐网站,在线问卷,旅游网站,流浪猫狗救助,在线选房,健身房管理,甜品网站,校园论坛,在线考试等设计题目, 可用于毕业设计和课程设计,喜欢的可以下载!
很多同学苦于没有参考的资料,或者下载的资料不全、代码有问题、数据有问题等等,造成一系列问题。
在这里完全不用担心以上所述问题,学姐亲测开发,所有系统均可完美运行!
不管同学们是出于什么需求。都希望各位计算机专业的同学有一个提高。
本系统采用eclipse/myeclipse开发工具,mysql数据库。
作品介绍
一、作品展示
二.关键代码段
public class FileController{
@Autowired
private ConfigService configService;
@RequestMapping("/upload")
public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception {
if (file.isEmpty()) {
throw new EIException("上传文件不能为空");
}
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+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);
}
@RequestMapping("/download")
public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) {
try {
File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName);
if (file.exists()) {
response.reset();
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\"");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setContentType("application/octet-stream; charset=UTF-8");
IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream());
}
} catch (IOException e) {
e.printStackTrace();
}
}