首页 分享 基于SSM的网上花店的设计与实现

基于SSM的网上花店的设计与实现

来源:花匠小妙招 时间:2024-09-02 16:18

目录

前言

 一、技术栈

二、系统功能介绍

管理员功能实现

花材选择管理

鲜花信息管理

鲜花入库管理

鲜花出库管理

已完成订单

用户功能实现

联系客服

鲜花信息

购买鲜花

我的订单

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装

前言

网络技术和计算机技术发展至今,已经拥有了深厚的理论基础,并在现实中进行了充分运用,尤其是基于计算机运行的软件更是受到各界的关注。加上现在人们已经步入信息时代,所以对于信息的宣传和管理就很关键。因此鲜花销售信息的管理计算机化,系统化是必要的。设计开发网上花店不仅会节约人力和管理成本,还会安全保存庞大的数据量,对于鲜花销售信息的维护和检索也不需要花费很多时间,非常的便利。

网上花店是在MySQL中建立数据表保存信息,运用SSM+Vue框架和Java语言编写。并按照软件设计开发流程进行设计实现。系统具备友好性且功能完善。管理员登录进入本人后台之后,主要完成花材选择管理,用户管理,鲜花管理,鲜花出入库管理,鲜花订单管理等。用户联系客服咨询问题,查看鲜花,可以收藏,购买,评论鲜花,支付订单,管理个人订单等。

网上花店在让鲜花销售信息规范化的同时,也能及时通过数据输入的有效性规则检测出错误数据,让数据的录入达到准确性的目的,进而提升网上花店提供的数据的可靠性,让系统数据的错误率降至最低。

 一、技术栈

末尾获取源码
SSM+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

管理员功能实现

花材选择管理

管理员权限中的花材选择管理,其运行效果见下图。花材选择管理需要管理员登记花材,删除,修改花材,查询花材等。

 

鲜花信息管理

管理员权限中的鲜花信息管理,其运行效果见下图。管理员在本模块登记鲜花信息,修改,删除鲜花信息,对鲜花进行出入库管理,查看鲜花评论等。

 

鲜花入库管理

管理员权限中的鲜花入库管理,其运行效果见下图。已经入库的鲜花信息,管理员可以管理,也能查看,其中的管理包括对入库的鲜花修改,删除,查询等。

 

鲜花出库管理

管理员权限中的鲜花出库管理,其运行效果见下图。已经出库的鲜花信息,管理员可以管理,也能查看,其中的管理包括对出库的鲜花修改,删除,查询等。

 

已完成订单

管理员权限中的已完成订单,其运行效果见下图。已完成订单只是订单管理的一部分功能,订单管理包括了已支付订单,未支付订单,取消的订单,已发货订单,已退款订单的管理。在已完成订单页面上,管理员能够直接查看订单详细,查询订单。

 

用户功能实现

联系客服

用户权限中的联系客服,其运行效果见下图。用户在操作过程中,可以联系客服咨询鲜花相关信息,客服会指引用户购买鲜花,解答用户疑问。

 

鲜花信息

用户权限中的鲜花信息,其运行效果见下图。用户在本页面可以操作的功能比较多,可以购买,收藏,评论鲜花,可以添加鲜花至购物车。

 

购买鲜花

用户权限中的购买鲜花,其运行效果见下图。用户直接购买鲜花,就会进入下面的操作页面,用户选择地址,进行支付即可。

 

我的订单

用户权限中的我的订单,其运行效果见下图。用户已支付订单,可以在我的订单模块中,在已支付栏下面查看订单,也能进行订单退款。

 

三、核心代码

1、登录模块

package com.controller;

import java.util.Arrays;

import java.util.Calendar;

import java.util.Date;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.GetMapping;

import org.springframework.web.bind.annotation.PathVariable;

import org.springframework.web.bind.annotation.PostMapping;

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.ResponseBody;

import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;

import com.baomidou.mybatisplus.mapper.EntityWrapper;

import com.entity.TokenEntity;

import com.entity.UserEntity;

import com.service.TokenService;

import com.service.UserService;

import com.utils.CommonUtil;

import com.utils.MD5Util;

import com.utils.MPUtil;

import com.utils.PageUtils;

import com.utils.R;

import com.utils.ValidatorUtils;

@RequestMapping("users")

@RestController

public class UserController{

@Autowired

private UserService userService;

@Autowired

private TokenService tokenService;

@IgnoreAuth

@PostMapping(value = "/login")

public R login(String username, String password, String captcha, HttpServletRequest request) {

UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));

if(user==null || !user.getPassword().equals(password)) {

return R.error("账号或密码不正确");

}

String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());

return R.ok().put("token", token);

}

@IgnoreAuth

@PostMapping(value = "/register")

public R register(@RequestBody UserEntity user){

if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {

return R.error("用户已存在");

}

userService.insert(user);

return R.ok();

}

@GetMapping(value = "logout")

public R logout(HttpServletRequest request) {

request.getSession().invalidate();

return R.ok("退出成功");

}

@IgnoreAuth

@RequestMapping(value = "/resetPass")

public R resetPass(String username, HttpServletRequest request){

UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));

if(user==null) {

return R.error("账号不存在");

}

user.setPassword("123456");

userService.update(user,null);

return R.ok("密码已重置为:123456");

}

@RequestMapping("/page")

public R page(@RequestParam Map<String, Object> params,UserEntity user){

EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();

PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));

return R.ok().put("data", page);

}

@RequestMapping("/list")

public R list( UserEntity user){

EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();

ew.allEq(MPUtil.allEQMapPre( user, "user"));

return R.ok().put("data", userService.selectListView(ew));

}

@RequestMapping("/info/{id}")

public R info(@PathVariable("id") String id){

UserEntity user = userService.selectById(id);

return R.ok().put("data", user);

}

@RequestMapping("/session")

public R getCurrUser(HttpServletRequest request){

Long id = (Long)request.getSession().getAttribute("userId");

UserEntity user = userService.selectById(id);

return R.ok().put("data", user);

}

@PostMapping("/save")

public R save(@RequestBody UserEntity user){

if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {

return R.error("用户已存在");

}

userService.insert(user);

return R.ok();

}

@RequestMapping("/update")

public R update(@RequestBody UserEntity user){

userService.updateById(user);

return R.ok();

}

@RequestMapping("/delete")

public R delete(@RequestBody Long[] ids){

userService.deleteBatchIds(Arrays.asList(ids));

return R.ok();

}

}

 2、文件上传模块

package com.controller;

import java.io.File;

import java.io.FileNotFoundException;

import java.io.IOException;

import java.util.Arrays;

import java.util.Date;

import java.util.HashMap;

import java.util.List;

import java.util.Map;

import java.util.Random;

import java.util.UUID;

import org.apache.commons.io.FileUtils;

import org.apache.commons.lang3.StringUtils;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.http.HttpHeaders;

import org.springframework.http.HttpStatus;

import org.springframework.http.MediaType;

import org.springframework.http.ResponseEntity;

import org.springframework.util.ResourceUtils;

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 org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;

import com.baomidou.mybatisplus.mapper.EntityWrapper;

import com.entity.ConfigEntity;

import com.entity.EIException;

import com.service.ConfigService;

import com.utils.R;

@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);

FileUtils.copyFile(dest, new File("C:UsersDesktopjiadianspringbootl7ownsrcmainresourcesstaticupload"+"/"+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()){

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);

}

}

3、代码封装

package com.utils;

import java.util.HashMap;

import java.util.Map;

public class R extends HashMap<String, Object> {

private static final long serialVersionUID = 1L;

public R() {

put("code", 0);

}

public static R error() {

return error(500, "未知异常,请联系管理员");

}

public static R error(String msg) {

return error(500, msg);

}

public static R error(int code, String msg) {

R r = new R();

r.put("code", code);

r.put("msg", msg);

return r;

}

public static R ok(String msg) {

R r = new R();

r.put("msg", msg);

return r;

}

public static R ok(Map<String, Object> map) {

R r = new R();

r.putAll(map);

return r;

}

public static R ok() {

return new R();

}

public R put(String key, Object value) {

super.put(key, value);

return this;

}

}

相关知识

基于SSM的网上花店的设计与实现
SSM开心鲜花系统5o1dr 虚拟支付
基于WEB的花卉养殖知识平台的设计与实现
基于JAVA馥郁花艺网站mp4计算机毕业设计源码+数据库+lw文档+系统+部署
基于Java的花卉销售系统的设计与实现/管理系统/鲜花网站
基于flask+vue框架的网上花店销售管理系统[开题+论文+程序]
基于SSM花卉商城设计与实现
鲜花售卖网站的设计与实现(源码+开题报告)
python计算机毕设(附源码)鲜花售卖网站的设计与实现(django+mysql5.7+文档)
javaWeb毕设分享 网上花店销售系统设计与实现【源码+论文】

网址: 基于SSM的网上花店的设计与实现 https://www.huajiangbk.com/newsview86677.html

所属分类:花卉
上一篇: 美团外卖上品软件快速的批量创建产
下一篇: 2024年花店软件供需分析

推荐分享