基于javaweb的前后端分离网上手机商城平台系统设计和实现(java+vue+redis+springboot+mysql+ssm)
运行环境
Java≥8、MySQL≥5.7、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的前后端分离网上手机商城平台系统设计和实现(java+vue+redis+springboot+mysql+ssm)
主要模块设计如下: 前后端主要技术:Java springboot springMVC mybatis mysql vue jquery node.js redis
用户注册和登录功能:。
2)用户信息的管理以及角色的管理、不同用户角色具有不同的功能权限操作。
商品的操作、包括商品列表信息、商品的分离、商品的详情、品牌和规格等操作。
4)购物车的管理操作:
5)订单管理操作:
6)用户退货管理
7)手机商品类型的管理
8)手机商品信息的预览、查看、搜索
9)修改密码、退出登录等功能
给大家截一部分效果图吧
系统首页:
加入购物车:
后台主要功能:
商品信息操作:
@CrossOrigin
@RestController
@RequestMapping(“Good”)
public class GoodController {
@Autowired
private GoodServiceImp goodServiceImp;
@GetMapping(“/getGood”)
private GoodResult getGood(@RequestParam(“pageIndex”) int pageIndex,
@RequestParam(“pageSize”) int pageSize,
@RequestParam(“name”) String goodname
) throws IOException {
GoodResult goodResult = goodServiceImp.getGood(pageIndex,pageSize,goodname);
return goodResult;
@GetMapping(“/getGoodById”)
private GoodResult getGoodById(@RequestParam(“category”) int pageIndex,
@RequestParam(“pageSize”) int pageSize
) throws IOException {
GoodResult goodResult = goodServiceImp.getGoodById(pageIndex,pageSize);
return goodResult;
@RequestMapping(“/getGoodByName”)
private GoodResult getGoodByName(@RequestParam(“name”) String goodname) throws IOException {
GoodResult goodResult = goodServiceImp.getGoodByName(goodname);
return goodResult;
@RequestMapping(“/updGood”)
private GoodResult getGoodByName(@RequestParam(“good_id”) int goodid,
@RequestParam(“name”) String goodname,
@RequestParam(“newhot”) int newhot) throws IOException {
GoodResult goodResult = goodServiceImp.updGood(goodid,goodname,newhot);
return goodResult;
@GetMapping(“/getGoodPicById”)
private GoodPicResult getGoodPicById(@RequestParam(“category”) int pageIndex,
@RequestParam(“pageSize”) int pageSize
) throws IOException {
GoodPicResult goodpicResult = goodServiceImp.getGoodPic(pageIndex,pageSize);
return goodpicResult;
@RequestMapping(“/getGoodPicByName”)
private GoodPicResult getGoodPicByName(@RequestParam(“name”) String goodname) throws IOException {
// int categor = Integer.parseInt(category);
GoodPicResult goodResult = goodServiceImp.getGoodPicByName(goodname);
return goodResult;
@PostMapping(“/pushGood”)
private GoodPushResult pushGood(@RequestBody good good) throws IOException {
GoodPushResult goodPushResult = goodServiceImp.getGoodPush(good);
return goodPushResult;
@PostMapping(“/delGood”)
private void delGood(@RequestBody good good) throws IOException {
goodServiceImp.delGood(good);
@PostMapping(“/delMulGood”)
private void delMulGood(@RequestBody List goods) throws IOException {
goodServiceImp.delMulGood(goods);
@GetMapping(“/getGoodPic”)
private GoodPicResult getGoodPic(@RequestParam(“pageIndex”) int pageIndex,
@RequestParam(“pageSize”) int pageSize) throws IOException {
GoodPicResult goodPicResult = goodServiceImp.getGoodPic(pageIndex,pageSize);
return goodPicResult;
@PostMapping(“/updGoodPic”)
private void upGoodPic(@RequestBody GoodPic goodPic) throws IOException {
int goodid= goodPic.getGood_id();
String icon= goodPic.getIcon();
String imageHead = goodPic.getImageHead();
String imageFoot = goodPic.getImageFoot();
goodServiceImp.updGoodPic(goodid,icon,1);
goodServiceImp.updGoodPic(goodid,imageHead,2);
goodServiceImp.updGoodPic(goodid,imageFoot,3);
订单业务管理:
@CrossOrigin
@RestController
@RequestMapping(“orders”)
public class OrderController {
@Autowired
private OrderServiceImp orderServiceImp;
@Autowired
private RegLogServiceImp regLogServiceImp;
@PostMapping(“/createorder”)
public OrderResult createOrder(@RequestBody OrdCreaParm ordCreaParm) throws IOException {
OrderResult orderResult = new OrderResult();
orderResult.setStatus(0);
OrderList orderList = orderServiceImp.creatOrder(ordCreaParm);
orderResult.setData(orderList);
return orderResult;
@RequestMapping(“/getorderlist”)
public UserOrdListResult getUserOrdList(String username) throws IOException {
UserOrdListResult userOrdListResult = new UserOrdListResult();
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
List orderList = orderServiceImp.getOrderList(userid);
for(UserOrdList userOrdList:orderList){
int orderNo = userOrdList.getOrderNo();
List orderListItems = orderServiceImp.getOrderListItems(orderNo);
userOrdList.setItems(orderListItems);
userOrdListResult.setStatus(0);
userOrdListResult.setTotal(orderList.size());
userOrdListResult.setList(orderList);
return userOrdListResult;
//下单成功后调用下面两个方法
@RequestMapping(“/getorder”)
public OrdFinaResult getOrder(@RequestParam(“id”) int id) throws IOException{
OrdFinaResult orderResult = new OrdFinaResult();
orderResult.setStatus(0);
OrdFina orderList = orderServiceImp.getOrderById(id);
orderResult.setOrdFina(orderList);
return orderResult;
@RequestMapping(“/getorderdetail”)
public OrdFinaResult getOrderDetail(@RequestParam(“username”) String username) throws IOException{
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
List orderItems = orderServiceImp.getOrderItems(userid);
OrdFinaResult orderResult = new OrdFinaResult();
orderResult.setStatus(0);
orderResult.setLists(orderItems);
return orderResult;
注册登录验证:
@CrossOrigin
@RestController
@RequestMapping(“login”)
public class LogRegController {
@Autowired
private RegLogServiceImp regLogServiceImp;
//注册功能
@RequestMapping(“/getRegister”)
public RegResult Register(@RequestParam(“username”) String username,
@RequestParam(“email”) String email,
@RequestParam(“password”) String password,
@RequestParam(“phone”) String phone) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException {
RegResult result = new RegResult();
System.out.println(username.length());
if(username.equals(“”) || email.equals(“”) || password.equals(“”) || phone.equals(“”)){
result.setStatus(404);
result.setMsg(“填写信息不全”);
return result;
User user = regLogServiceImp.getUserByName(username);
if (user != null) {
result.setStatus(2002);
result.setMsg(“账号已存在,注册失败!”);
else {
String userid = UUID.randomUUID().toString();
Map<String, String> keyMap = RSAUtils.createKeys(512);
String publicKey = keyMap.get(“publicKey”);
String privateKey = keyMap.get(“privateKey”);
//公钥加密
String encodedData = RSAUtils.publicEncrypt(password,RSAUtils.getPublicKey(publicKey));
String date = DateUtil.ptfDate();
regLogServiceImp.insertUser(userid,username,email,encodedData,phone,“可用”,date,privateKey);
result.setStatus(200);
result.setMsg(“注册成功!”);
return result;
//登录验证
@RequestMapping(“/UserLogin”)
public LoginResult Login(@RequestParam(“username”) String username,
@RequestParam(“password”) String password) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException {
User user = regLogServiceImp.getUserByUserName(username);
LoginResult result = new LoginResult();
LoginData loginData = new LoginData();
if(user==null){
result.setMsg(“无此用户,请重新输入正确用户名”);
result.setStatus();
else {
if(RSAUtils.privateDecrypt(user.getPwd(), RSAUtils.getPrivateKey(user.getPrivatekey().trim())).equals(password)){
result.setStatus(0);
String token = TokenUtil.token(user.getUserid().trim());
loginData.setToken(token);
result.setMsg(“登录成功”);
result.setData(loginData);
else {
result.setStatus();
result.setMsg(“密码错误”);
return result;
购物车业务操作:
@CrossOrigin
@RestController
@RequestMapping(“carts”)
public class CartController {
@Autowired
private RegLogServiceImp regLogServiceImp;
@Autowired
private GoodServiceImp goodServiceImp;
@Autowired
private CartServiceImp cartServiceImp;
@PostMapping(“/push”)
public CartResult putShop(@RequestBody pushCart pushcart) throws IOException {
CartResult cartResult = new CartResult();
boolean success = TokenUtil.verify(pushcart.getToken());
if (success) {
cartResult.setStatus(0);
User user = regLogServiceImp.getUserByUserName(pushcart.getUsername().trim());
String userid = user.getUserid();
CartGood cartGood = goodServiceImp.getGoodByid(userid, pushcart.getProductId());
if (cartGood == null) {
int goodcount = 1;
CartGoodInsert goodByidinsert = goodServiceImp.getGoodByidinsert(pushcart.getProductId());
goodServiceImp.insCartGood(userid, pushcart.getProductId(), goodByidinsert.getName(),
goodByidinsert.getPrice(), goodcount, goodByidinsert.getSubtitle(), goodByidinsert.getProductStock(),
goodByidinsert.getStatus(), true);
} else {
goodServiceImp.updateCartGood(userid, cartGood.getCount() + 1, pushcart.getProductId(), (cartGood.getCount() + 1) * cartGood.getPrice());
cartProductVoList cartProductVoList = cartServiceImp.getCartProduct(userid);
int cartTotalPrice = 0;
boolean selectedAll = true;
int cartTotalQuantity = 0;
for (cartProduct cartProduct : cartProductVoList.getList()) {
cartTotalPrice += cartProduct.getProductTotalPrice();
if (!cartProduct.isProductSelected()) {
selectedAll = false;
cartTotalQuantity += cartProduct.getCount();
cartResult.setStatus(0);
cartResult.setCartTotalPrice(cartTotalPrice);
cartResult.setCartTotalQuantity(cartTotalQuantity);
cartResult.setData(cartProductVoList);
cartResult.setImageHost(“”);
cartResult.setSelectedAll(selectedAll);
} else {
cartResult.setStatus(10);
return cartResult;
@GetMapping(“/sum”)
public CartResult getCartSum(@RequestParam(“username”) String username) throws IOException {
CartResult cartResult = new CartResult();
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
cartProductVoList cartProductVoList = cartServiceImp.getCartProduct(userid);
if(cartProductVoList==null){
cartResult.setStatus(0);
cartResult.setCartTotalQuantity(0);
else {
int cartTotalQuantity=0;
for(cartProduct cartProduct:cartProductVoList.getList()){
cartTotalQuantity+=cartProduct.getCount();
cartResult.setStatus(0);
cartResult.setCartTotalQuantity(cartTotalQuantity);
return cartResult;
@RequestMapping(“/del”)
public CartResult delCarts(@RequestParam(“id”) int goodid,
@RequestParam(“username”) String username) throws IOException {
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
goodServiceImp.delGoodByid(userid,goodid);
CartResult cartResult = getCarts(username);
return cartResult;
@RequestMapping(“/getcarts”)
public CartResult getCarts (@RequestParam(“username”) String username) throws IOException {
CartResult cartResult = new CartResult();
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
cartProductVoList cartProductVoList = cartServiceImp.getCartProduct(userid);
if(cartProductVoList==null){
cartResult.setStatus(0);
cartResult.setCartTotalQuantity(0);
cartResult.setSelectedAll(false);
cartResult.setImageHost(“”);
cartResult.setCartTotalQuantity(0);
else {
int carttotalPrice=0;
boolean selectedall=true;
int carttotalQuantity=0;
for(cartProduct cartProduct:cartProductVoList.getList()){
if(cartProduct.isProductSelected())
carttotalPrice+=cartProduct.getProductTotalPrice();
if(!cartProduct.isProductSelected()){
selectedall=false;
carttotalQuantity+=cartProduct.getCount();
cartResult.setStatus(0);
cartResult.setCartTotalPrice(carttotalPrice);
cartResult.setCartTotalQuantity(carttotalQuantity);
cartResult.setData(cartProductVoList);
cartResult.setImageHost(“”);
cartResult.setSelectedAll(selectedall);
return cartResult;
@GetMapping(“/updatecart”)
public CartResult getCarts (
@RequestParam(“goodid”) int goodid,
@RequestParam(“username”) String username,
@RequestParam(“quantity”) int count,
@RequestParam(“selected”) boolean selected
) throws IOException {
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
CartGood goodByid = goodServiceImp.getGoodByid(userid, goodid);
goodServiceImp.updaCartNumSel(userid,goodid,count,selected,goodByid.getPrice()*count);
CartResult carts = getCarts(username);
return carts;
@GetMapping(“/selectAll”)
public CartResult SelectAllCart(@RequestParam(“username”) String username) throws IOException {
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
goodServiceImp.updaCartSelect(userid);
CartResult cartResult = getCarts(username);
return cartResult;
@GetMapping(“/unSelectAll”)
public CartResult unSelectAllCart(@RequestParam(“username”) String username) throws IOException {
User user = regLogServiceImp.getUserByUserName(username);
String userid = user.getUserid();
goodServiceImp.updaCartunSelect(userid);
CartResult cartResult = getCarts(username);
cartResult.setCartTotalQuantity(0);
cartResult.setCartTotalPrice(0);
return cartResult;
如果觉得《基于javaweb的前后端分离网上手机商城平台系统设计和实现(java+vue+redis+springboot+mysql+ssm)》对你有帮助,请点赞、收藏,并留下你的观点哦!