社会的发展和科学技术的进步,互联网技术越来越受欢迎。网络计算机的交易方式逐渐受到广大人民群众的喜爱,也逐渐进入了每个用户的使用。互联网具有便利性,速度快,效率高,成本低等优点。 因此,构建符合自己要求的操作系统是非常有意义的。
本文从管理员、用户的功能要求出发,家具销售电商平台系统中的功能模块主要是实现管理员;首页、个人中心、家具分类管理、热销家具管理、折扣家具管理、用户管理、订单评价管理、管理员管理、系统管理、订单管理,用户:首页、个人中心、订单评价管理、我的收藏管理、订单管理。前台首页:首页、热销家具、折扣家具、公告资讯、个人中心、后台管理、客服。
经过认真细致的研究,精心准备和规划,最后测试成功,系统可以正常使用。分析功能调整与家具销售电商平台实现的实际需求相结合,讨论了Java开发家具销售电商平台的使用。
关键字:家具销售电商平台 Java语言 Spring Boot框架
管理员、用户登录功能是系统中一个非常重要的功能模块。这个函数模块需要做的第一件事是设计系统的安全性。不能说任何打开登录界面的人都可以进入系统。我们想控制管理。用户的账号和密码,只有拥有权限的用户才能通过这个登录界面进入系统管理界面,这是非常重要的。用户想要登录和使用系统首先进入登录账户和登录密码,然后我们使用程序来检索,检索数据库中的账户信息一致输入账号密码,如果输入账号信息让用户登录时,如果它不存在,给一个提示,非法登陆,所以这个功能模块是非常重要的。
前台首页功能模块
家具销售电商平台 ,在系统首页可以查看首页、热销家具、折扣家具、公告资讯、个人中心、后台管理、购物车、客服等内容,如图
登录、用户注册,在用户注册页面可以填写用户名、密码、姓名、手机、邮箱等信息进行注册,如图
热销家具,在热销家具页面通过填写家具名称、分类、风格、类型、图片、规格、品牌、价格等信息进行立即提交,如图所示。在折扣家具管理页面通过填写家具名称、分类、风格、类型、图片、规格、品牌、价格等信息进行立即提交操作,如图
用户功能模块
个人信息,在个人信息页面可以查看用户名、密码、姓名、性别、头像、手机、邮箱等信息,并可根据需要对个人信息进行删除,修改或查看详细内容等操作,如图
订单评价管理,用户通过订单评价管理可以查看订单编号、评价标题、订单评分、评价日期、用户名、手机、审核回复、审核状态等信息,进行详情修改或删除,如图
我的收藏管理,用户通过我的收藏管理可以查看收藏ID、表名、收藏名称、收藏图片等信息,进行详情修改或删除,如图
订单管理,用户通过订单管理可以查看订单编号、商品名称、商品图片、购买数量、价格/积分、折扣价格、总价格/总积分、折扣总价格、支付类型、状态、地址等信息,进行详情修改或删除,如图
管理员功能模块
部分核心代码:
package com.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.utils.ValidatorUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
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 com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.annotation.IgnoreAuth;
import com.entity.CartEntity;
import com.entity.view.CartView;
import com.service.CartService;
import com.service.TokenService;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.MPUtil;
import com.utils.CommonUtil;
/**
* 购物车表
* 后端接口
* @author
* @email
* @date 2021-01-15 12:19:26
*/
@RestController
@RequestMapping("/cart")
public class CartController {
@Autowired
private CartService cartService;
/**
* 后端列表
*/
@RequestMapping("/page")
public R page(@RequestParam Map params,CartEntity cart, HttpServletRequest request){
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
cart.setUserid((Long)request.getSession().getAttribute("userId"));
}
EntityWrapper ew = new EntityWrapper();
PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));
return R.ok().put("data", page);
}
/**
* 前端列表
*/
@RequestMapping("/list")
public R list(@RequestParam Map params,CartEntity cart, HttpServletRequest request){
EntityWrapper ew = new EntityWrapper();
PageUtils page = cartService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.likeOrEq(ew, cart), params), params));
return R.ok().put("data", page);
}
/**
* 列表
*/
@RequestMapping("/lists")
public R list( CartEntity cart){
EntityWrapper ew = new EntityWrapper();
ew.allEq(MPUtil.allEQMapPre( cart, "cart"));
return R.ok().put("data", cartService.selectListView(ew));
}
/**
* 查询
*/
@RequestMapping("/query")
public R query(CartEntity cart){
EntityWrapper< CartEntity> ew = new EntityWrapper< CartEntity>();
ew.allEq(MPUtil.allEQMapPre( cart, "cart"));
CartView cartView = cartService.selectView(ew);
return R.ok("查询购物车表成功").put("data", cartView);
}
/**
* 后端详情
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id){
CartEntity cart = cartService.selectById(id);
return R.ok().put("data", cart);
}
/**
* 前端详情
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id){
CartEntity cart = cartService.selectById(id);
return R.ok().put("data", cart);
}
/**
* 后端保存
*/
@RequestMapping("/save")
public R save(@RequestBody CartEntity cart, HttpServletRequest request){
cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cart);
cart.setUserid((Long)request.getSession().getAttribute("userId"));
cartService.insert(cart);
return R.ok();
}
/**
* 前端保存
*/
@RequestMapping("/add")
public R add(@RequestBody CartEntity cart, HttpServletRequest request){
cart.setId(new Date().getTime()+new Double(Math.floor(Math.random()*1000)).longValue());
//ValidatorUtils.validateEntity(cart);
cartService.insert(cart);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody CartEntity cart, HttpServletRequest request){
//ValidatorUtils.validateEntity(cart);
cartService.updateById(cart);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
cartService.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 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 wrapper = new EntityWrapper();
if(map.get("remindstart")!=null) {
wrapper.ge(columnName, map.get("remindstart"));
}
if(map.get("remindend")!=null) {
wrapper.le(columnName, map.get("remindend"));
}
if(!request.getSession().getAttribute("role").toString().equals("管理员")) {
wrapper.eq("userid", (Long)request.getSession().getAttribute("userId"));
}
int count = cartService.selectCount(wrapper);
return R.ok().put("count", count);
}
}