- 前台首图,用户可以在此页面搜索鲜花 查看热销鲜花 按分类查看鲜花等
2.后台首图,这里是鲜花管理后台
3.后台可视化页面,使用echarts对系统数据进行可视化展示
部分代码
java
package com.flower.flower.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.flower.flower.entity.Category;
import com.flower.flower.entity.Flower;
import com.flower.flower.service.CategoryService;
import com.flower.flower.service.FlowerService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
/**
* (Flower)表控制层
*
*
*
*/
@Controller
@RequestMapping("flower")
public class FlowerController {
/**
* 服务对象
*/
@Resource
private FlowerService flowerService;
@Resource
private CategoryService categoryService;
/**
* 查看所有鲜花
*
* @return 后端多条数据
*/
@GetMapping("selectAllFlower")
public String selectAllFlower(Model model) {
List<Flower> flowers = this.flowerService.queryAllFlowers();
if (ObjectUtil.isNotNull(flowers)) {
model.addAttribute("flowers", flowers);
return "find_flr";
} else {
model.addAttribute("msg", "暂无数据");
return "find_flr";
}
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("selectOne")
public Flower selectOne(Integer id) {
return this.flowerService.queryById(id);
}
/**
* 根据分类查看所有鲜花
*/
@GetMapping("selectCategory")
public String selectCategory(Integer flowerName, Model model) {
List<Flower> flowers = flowerService.selectCategory(flowerName);
if (ObjectUtil.isNotNull(flowers)) {
model.addAttribute("flowers", flowers);
return "index";
} else {
model.addAttribute("msg", "暂无数据");
return "index";
}
}
/**
* 前台模糊查询多条数据
*
* @param flowerName
* @return 多条数据
*/
@PostMapping("selectFlowerLikeName")
public String selectFlowerLikeName(String flowerName, Model model) {
model.addAttribute("flowers", flowerName);
List<Flower> flowers = flowerService.selectFlowerLikeName(flowerName);
if (ObjectUtil.isNotNull(flowers)) {
model.addAttribute("flowers", flowers);
return "index";
} else {
model.addAttribute("msg", "暂无数据");
return "index";
}
}
/**
* 后台模糊查询多条数据
*
* @param flowerName
* @return 多条数据
*/
@PostMapping("selectFlowerLikeNameBack")
public String selectFlowerLikeNameBack(String flowerName, Model model) {
model.addAttribute("flowers", flowerName);
List<Flower> flowers = flowerService.selectFlowerLikeName(flowerName);
if (ObjectUtil.isNotNull(flowers)) {
model.addAttribute("flowers", flowers);
return "find_flr";
} else {
model.addAttribute("msg", "暂无数据");
return "find_flr";
}
}
/**
* 添加鲜花
*/
@PostMapping("addFlower")
public void addFlower(Flower flower, HttpServletResponse response, HttpSession session) throws IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
if (ObjectUtil.isNotNull(flower)) {
String fileName = (String) session.getAttribute("fileName");
flower.setFlowerImage(fileName);
int count = 0;
try {
count=flowerService.insert(flower);
} catch (Exception e) {
System.out.println("失败原因:"+e.getMessage());
count=0;
}
if (count > 0) {
out.write(" <script> alert( '添加成功 ');" +
"window.location.href= 'selectAllFlower' </script> ");
}
out.write(" <script> alert( '添加失败 ');" +
"window.location.href= 'selectAllFlower' </script> ");
}
}
/**
* 跳转到添加鲜花页
*/
@GetMapping("addFlowerPage")
public String addFlower(Model model) {
List<Category> categories = categoryService.queryAll();
if (ObjectUtil.isNotNull(categories)) {
model.addAttribute("categories", categories);
return "add_flower";
}
return "add_flower";
}
/**
* 修改鲜花
*/
@PostMapping("updateFlower")
public void updateFlower(Flower flower, HttpServletResponse response,HttpSession session) throws IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
System.out.println(flower.getFlowerNewPrice()+"==++");
if (ObjectUtil.isNotNull(flower)) {
String fileName = (String) session.getAttribute("fileName");
flower.setFlowerImage(fileName);
Flower update = flowerService.update(flower);
if (ObjectUtil.isNotNull(update)) {
out.write(" <script> alert( '修改成功 ');" +
"window.location.href= 'selectAllFlower' </script> ");
}
out.write(" <script> alert( '修改失败 ');" +
"window.location.href= 'selectAllFlower' </script> ");
} else {
out.write(" <script> alert( '请输入正确的信息 ');" +
"window.location.href= 'selectAllFlower' </script> ");
}
}
/**
* 修改鲜花页
*/
@GetMapping("updateFloPage")
public String updateFloPage(Model model, Integer flowerId) {
Flower flower = flowerService.queryById(flowerId);
model.addAttribute("flower", flower);
return "update_flr";
}
/**
* 跳转到鲜花详情页
*/
@GetMapping("productDetails")
public String productDetails(Integer flowerId, Model model) {
Flower flower = flowerService.queryById(flowerId);
model.addAttribute("flower", flower);
return "product-details";
}
/**
* 鲜花上下架
*/
@GetMapping("flowerUpAndDown")
public void flowerUpAndDown(Integer flowerId, Integer status, HttpServletResponse response) throws IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
Flower flower = flowerService.queryById(flowerId);
flower.setFlowerStatus(status);
Flower update = flowerService.update(flower);
if (ObjectUtil.isNotNull(update)) {
out.write(" <script> alert( '操作成功 ');" +
"window.location.href= 'selectAllFlower' </script> ");
} else {
out.write(" <script> alert( '操作失败 ');" +
"window.location.href= 'selectAllFlower' </script> ");
}
}
/**
* 删除鲜花
*/
@GetMapping("deleteFlowerById")
public void deleteFlowerById(Integer flowerId, HttpServletResponse response) throws IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
boolean b = flowerService.deleteById(flowerId);
if (b) {
out.write(" <script> alert( '删除成功 ');" +
"window.location.href= 'selectAllFlower' </script> ");
} else {
out.write(" <script> alert( '移除失败 ');" +
"window.location.href= 'selectAllFlower' </script> ");
}
}
}
4.用户个人信息图片,这里可以查看个人订单,修改信息 退出登录等
5.购物车页面
6.未完成订单,可以对未完成订单进行发货等
7.鲜花管理,可以添加鲜花 修改鲜花 鲜花上下架等
8.添加鲜花
因篇幅有限,部分功能没有截图
代码目录:
系统背景 :
中国进入新时代新征程,人们对精神生活的需求越来越多。鲜花作为新时代青年大学生节日赠送的首要选择,其市场需求也逐年扩大。传统花店或企业的经营模式中,需要投入大量人工、物力且覆盖面小、客户量低、利润来源固化,整个鲜花的销售处于手工或者半手工的状态,效率低下、可靠性低下。随着花店或企业的业务规模的不断扩大,传统的交易模式问题越来越严重。
创新点:
1.使用Echarts对鲜花销量、销售金额进行图形化展示,方便管理员查看。
2.智能推荐:根据用户以往的订单记录来为用户推荐相似的鲜花。
主要功能 :
本系统的主要功能分为用户管理、购物车管理、鲜花管理、分类管理、订单管理五大模块
开发平台及使用技术 :
系统:Window10 开发语言:Java 数据库:Mysql 开发工具:IDEA
使用技术:
Spring Boot+Mybatis+HTML+CSS+JavaScript+Thymeleaf