基于springboot二手书交易平台源码和论文

摘  要

伴随着移动互联网的发展,各种各样电子商务平台如潮水般发生。一个好的电子商务平台应当具有用户感受高、用户网络信息安全的特性,才可以达到大量用户的要求。尽管目前的电子商务平台在逐步完善,但依然具有好多问题。本设计方案是设计一个java springboot架构的二手书籍交易商城项目。它在能够更好地完成电子商务平台的基本上面有一些革新和改善,如分层次搭建的设计观念,md5加密技术的完善和更友善的操作面板的设计方案,进而更好的服务大家。

这二手书籍交易商城平台是以IDEA mysql为开发工具,HTML CSS JavaScript为网页页面编写语言表达,springboot mybatis为后台管理编写语言表达开发设计的。二手书籍交易商城的发展趋势仅仅以公司独立发展趋势为目地。根据J2EE系统软件的二手书籍交易商城具备较高的安全系数和可靠性,及其优良的可维护性和混合开发特点。在海外,J2EE已经变成开发设计电子商务平台的主要技术性。文中开发设计的二手书籍商城系统软件使消费者可以买东西。不但二手书籍的建议更合乎消费者的消费习惯,并且二手书籍的产品质量和用户私人信息也可以获得有效的确保,进而提高消费者的消费感受。本体系关键是为用户设计方案选购、加上加入购物车、提交订单等作用。自然,与之相匹配的也有后台系统管理方法,主要是适用和管理方法一个前面数据信息,也就是用户端。仅有管理人员可以登陆。

文中根据springboot mybatis的架构,详细完成了一个二手书籍交易商城系统软件,可以为用户给予选购二手书籍等各种作用。从检测效果看来,系统软件已经彻底完成了所需要的作用,而且具备一定的稳定度和稳定性,可以为用户给予优良的用户感受。总而言之,本系统软件基本上达到了用户的要求,做到了期望的总体目标。

【541】基于springboot二手书交易平台源码和论文

关键词:  二手书籍交易商城  Idea  mysql  springboot

Abstract

With the development of mobile Internet, a variety of e-commerce platforms have emerged. A good e-commerce platform should have the characteristics of high user experience and user network information security, so as to meet the requirements of a large number of users. Although the current e-commerce platform is gradually improving, there are still many problems. This design is to design a second-hand musical instrument trading mall project based on Java springboot architecture. It has some innovations and improvements on the basis of being able to better complete the e-commerce platform, such as the design concept of hierarchical construction, the improvement of MD5 encryption technology and the design scheme of a more friendly operation panel, so as to better serve everyone.

This second-hand musical instrument trading mall platform is designed with idea MySQL as the development tool, HTML CSS JavaScript as the language expression for web pages, and springboot mybatis as the language expression development for background management. The development trend of the second-hand musical instrument trading mall only aims at the independent development trend of the company. The second-hand musical instrument trading mall based on J2EE system software has high safety coefficient and reliability, as well as excellent maintainability and mixed development characteristics. Overseas, J2EE has become the main technology for developing and designing e-commerce platform. The second-hand musical instrument mall system software developed and designed in this paper enables consumers to buy things. Not only are the suggestions of second-hand musical instruments more in line with consumers' consumption habits, but also the product quality and users' personal information of second-hand musical instruments can be effectively ensured, thus improving consumers' consumption feelings. The key of this system is to design and purchase schemes for users, add shopping carts and submit orders. Naturally, there is also a background system management method that matches it. It mainly applies to and manages the front data information, that is, the client. Only administrators can log in.

According to the architecture of springboot mybatis, this paper has completed a second-hand musical instrument trading mall system software in detail, which can provide users with various functions such as purchasing second-hand musical instruments. From the detection effect, the system software has completely completed the required functions, and has a certain degree of stability and stability, which can give users a good user experience. In a word, the system software basically meets the requirements of users and achieves the expected overall goal.

Key words: shop Idea  mysql  springboot

【541】基于springboot二手书交易平台源码和论文

package com.hn.secondhand.control.user;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hn.secondhand.dto.OrderDTO;
import com.hn.secondhand.dto.OrderInfoDTO;
import com.hn.secondhand.po.Goods;
import com.hn.secondhand.po.Order;
import com.hn.secondhand.po.User;
import com.hn.secondhand.service.GoodsService;
import com.hn.secondhand.service.OrderService;
import com.hn.secondhand.tool.Result;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by hn on 2023-4-11.
 */
@Controller("user/OrderController")
@RequestMapping("user")
public class OrderController {
    @Resource
    private HttpServletRequest request;

    @Resource
    private OrderService orderService;

    @Resource
    private GoodsService goodsService;

    @GetMapping("/order")
    public String goOrder() {
        return "/user/order";
    }

    // 异步获取我发起的订单分页数据
    @PostMapping("/order/buyer")
    @ResponseBody
    public Result buyOrder(Integer pageNum, Integer pageSize) {
        User sessionUser = (User) request.getSession().getAttribute("user");
        // 设置分页规则
        PageHelper.startPage(pageNum, pageSize);
        Page<Order> orderList = orderService.pageByBuyerID(sessionUser.getId());
        // 封装订单数据
        Page<OrderInfoDTO> orderPage = new Page<>();
        for (int i = 0; i < orderList.size(); i++) {
            OrderInfoDTO orderInfoDTO= new OrderInfoDTO();
            Order order = orderList.get(i);
            Goods goods = goodsService.getGoodsById(order.getGoods_id());
            orderInfoDTO.setId(order.getId());
            orderInfoDTO.setBuyer_id(order.getBuyer_id());
            orderInfoDTO.setBuyer_name(order.getBuyer_name());
            orderInfoDTO.setBuyer_address(order.getBuyer_address());
            orderInfoDTO.setBuyer_phone(order.getBuyer_phone());
            orderInfoDTO.setSeller_id(order.getSeller_id());
            orderInfoDTO.setGoods_id(order.getGoods_id());
            orderInfoDTO.setGoods_title(goods.getTitle());
            orderInfoDTO.setGoods_price(goods.getPrice());
            orderInfoDTO.setGoods_phone(goods.getContact());
            orderInfoDTO.setGoods_image(goods.getImage());
            orderInfoDTO.setGmt_create(order.getGmt_create());
            orderInfoDTO.setGmt_modified(order.getGmt_modified());
            orderInfoDTO.setDisplay(order.getDisplay());
            orderPage.add(orderInfoDTO);
        }
        orderPage.setPageNum(orderList.getPageNum());
        orderPage.setPageSize(orderList.getPageSize());
        orderPage.setStartRow(orderList.getStartRow());
        orderPage.setEndRow(orderList.getEndRow());
        orderPage.setTotal(orderList.getTotal());
        orderPage.setPages(orderList.getPages());
        orderPage.setReasonable(orderList.getReasonable());
        return Result.success("我发起的订单", orderPage.toPageInfo());
    }

    // 异步获取我收到的订单分页数据
    @PostMapping("/order/seller")
    @ResponseBody
    public Result sellOrder(Integer pageNum, Integer pageSize) {
        User sessionUser = (User) request.getSession().getAttribute("user");
        // 设置分页规则
        PageHelper.startPage(pageNum, pageSize);
        Page<Order> orderList = orderService.pageBySellerID(sessionUser.getId());
        // 封装订单数据
        Page<OrderInfoDTO> orderPage = new Page<>();
        for (int i = 0; i < orderList.size(); i++) {
            OrderInfoDTO orderInfoDTO= new OrderInfoDTO();
            Order order = orderList.get(i);
            Goods goods = goodsService.getGoodsById(order.getGoods_id());
            orderInfoDTO.setId(order.getId());
            orderInfoDTO.setBuyer_id(order.getBuyer_id());
            orderInfoDTO.setBuyer_name(order.getBuyer_name());
            orderInfoDTO.setBuyer_address(order.getBuyer_address());
            orderInfoDTO.setBuyer_phone(order.getBuyer_phone());
            orderInfoDTO.setSeller_id(order.getSeller_id());
            orderInfoDTO.setGoods_id(order.getGoods_id());
            orderInfoDTO.setGoods_title(goods.getTitle());
            orderInfoDTO.setGoods_price(goods.getPrice());
            orderInfoDTO.setGoods_phone(goods.getContact());
            orderInfoDTO.setGoods_image(goods.getImage());
            orderInfoDTO.setGmt_create(order.getGmt_create());
            orderInfoDTO.setGmt_modified(order.getGmt_modified());
            orderInfoDTO.setDisplay(order.getDisplay());
            orderPage.add(orderInfoDTO);
        }
        orderPage.setPageNum(orderList.getPageNum());
        orderPage.setPageSize(orderList.getPageSize());
        orderPage.setStartRow(orderList.getStartRow());
        orderPage.setEndRow(orderList.getEndRow());
        orderPage.setTotal(orderList.getTotal());
        orderPage.setPages(orderList.getPages());
        orderPage.setReasonable(orderList.getReasonable());
        return Result.success("我收到的订单", orderPage.toPageInfo());
    }

    // 用户下单
    @PostMapping("/order/insert")
    @ResponseBody
    public Result insert(@RequestBody OrderDTO orderDTO) {
        User sessionUser = (User) request.getSession().getAttribute("user");
        if (sessionUser == null) {
            return Result.fail("请先登录");
        }
        List<Order> orderList = new ArrayList<>();
        for (int i = 0; i < orderDTO.getGoodsList().size(); i++) {
            Order order = new Order();
            order.setBuyer_id(sessionUser.getId());
            order.setBuyer_name(orderDTO.getBuyer_name());
            order.setBuyer_address(orderDTO.getBuyer_address());
            order.setBuyer_phone(orderDTO.getBuyer_phone());
            order.setSeller_id(orderDTO.getGoodsList().get(i).getUid());
            order.setGoods_id(orderDTO.getGoodsList().get(i).getId());
            Date date = new Date();
            order.setGmt_create(date);
            order.setGmt_modified(date);
            order.setDisplay(0);
            orderList.add(order);
        }
        int res = orderService.insertBatch(orderList);
        if (res < 1) {
            return Result.fail("系统异常");
        }
        return Result.success("下单成功");
    }

    // 更新订单状态
    @PostMapping("/order/update")
    @ResponseBody
    public Result update(Order order) {
        int res = orderService.updateDisplay(order);
        if (res != 1) {
            return Result.fail("系统异常");
        } else {
            if (order.getDisplay() == 1) {
                return Result.success("更新成功,请及时发货");
            } else {
                return Result.success("收货成功");
            }

        }
    }

    // 删除订单
    @PostMapping("/order/delete")
    @ResponseBody
    public Result delete(Integer id) {
        int res = orderService.delete(id);
        if (res != 1) {
            return Result.fail("系统异常");
        } else {
            return Result.success("删除成功");
        }
    }
}

package com.hn.secondhand.control.user;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.hn.secondhand.dto.GoodsDTO;
import com.hn.secondhand.po.Goods;
import com.hn.secondhand.po.Sort;
import com.hn.secondhand.po.User;
import com.hn.secondhand.service.GoodsService;
import com.hn.secondhand.service.SortService;
import com.hn.secondhand.tool.Result;
import com.hn.secondhand.tool.UploadUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;

/**
 * Created by hn on 2021-4-11.
 */
@Controller("user/GoodsController")
@RequestMapping("user")
public class GoodsController {

    @Resource
    private HttpServletRequest request;

    @Resource
    private SortService sortService;

    @Resource
    private GoodsService goodsService;

    // 进入发布闲置书籍页面
    @GetMapping("/goods/publish")
    public String goPublish(Model model) {
        List<Sort> sortList = sortService.list();
        model.addAttribute("sortList", sortList);
        return "/user/goods_publish";
    }

    // 发布闲置书籍
    @PostMapping("/goods/publish")
    @ResponseBody
    public Result publish(GoodsDTO goodsDTO) {
        User sessionUser = (User) request.getSession().getAttribute("user");
        try {
            MultipartFile uploadFile = goodsDTO.getImage();
            // 对要上传的图片重命名
            String newFileName = UploadUtils.getNewFileName(uploadFile);
            // 获取存放上传图片的文件夹
            File fileDir = UploadUtils.getImgDirFile();
            // 构建真实的文件路径
            File newFile = new File(fileDir.getAbsolutePath() + File.separator + newFileName);
            // 上传文件
            uploadFile.transferTo(newFile);

            // 保存数据
            Goods goods = new Goods();
            goods.setSort(goodsDTO.getSort());
            goods.setTitle(goodsDTO.getTitle());
            goods.setPrice(goodsDTO.getPrice());
            goods.setContact(goodsDTO.getContact());
            goods.setInfo(goodsDTO.getInfo());
            goods.setImage(newFileName);
            goods.setUid(sessionUser.getId());
            Date date = new Date();
            goods.setGmt_create(date);
            goods.setGmt_modified(date);
            goods.setDisplay(0);
            int res = goodsService.insert(goods);
            if (res < 1) {
                return Result.fail("系统异常");
            }
        } catch (IOException e) {
            e.printStackTrace();
            return Result.fail("系统异常");
        }
        return Result.success("发布成功");
    }

    // 转到我的闲置页面
    @GetMapping("/goods")
    public String goUserGoods() {
        return "user/goods";
    }

    // 异步获取我的闲置分页数据
    @PostMapping("/goods")
    @ResponseBody
    public Result userGoods(Integer pageNum, Integer pageSize) {
        User sessionUser = (User) request.getSession().getAttribute("user");
        // 设置分页规则
        PageHelper.startPage(pageNum, pageSize);
        Page<Goods> goodsList = goodsService.pageGoodsByUid(sessionUser.getId());
        return Result.success("我的闲置列表", goodsList.toPageInfo());
    }

    // 进入更新闲置书籍页面
    @GetMapping("/goods/update/{id}")
    public String goUpdate(@PathVariable Integer id, Model model) {
        Goods goods = goodsService.getGoodsById(id);
        model.addAttribute("goods", goods);
        List<Sort> sortList = sortService.list();
        model.addAttribute("sortList", sortList);
        return "/user/goods_update";
    }

    // 更新闲置书籍
    @PostMapping("/goods/update")
    @ResponseBody
    public Result update(GoodsDTO goodsDTO) {
        User sessionUser = (User) request.getSession().getAttribute("user");
        try {
            MultipartFile uploadFile = goodsDTO.getImage();
            // 对要上传的图片重命名
            String newFileName = UploadUtils.getNewFileName(uploadFile);
            // 获取存放上传图片的文件夹
            File fileDir = UploadUtils.getImgDirFile();
            // 构建真实的文件路径
            File newFile = new File(fileDir.getAbsolutePath() + File.separator + newFileName);
            System.out.println("newFile = " + newFile);
            // 上传文件
            uploadFile.transferTo(newFile);

            // 更新数据
            Goods goods = new Goods();
            goods.setId(goodsDTO.getId());
            goods.setSort(goodsDTO.getSort());
            goods.setTitle(goodsDTO.getTitle());
            goods.setPrice(goodsDTO.getPrice());
            goods.setContact(goodsDTO.getContact());
            goods.setInfo(goodsDTO.getInfo());
            goods.setImage(newFileName);
            goods.setDisplay(0);
            int res = goodsService.update(goods);
            if (res != 1) {
                return Result.fail("系统异常");
            }
        } catch (IOException e) {
            e.printStackTrace();
            return Result.fail("系统异常");
        }
        return Result.success("更新成功");
    }

    // 删除闲置书籍
    @PostMapping("/goods/delete")
    @ResponseBody
    public Result deleteGoods(Integer id) {
        int res = goodsService.delete(id);
        if (res != 1) {
            return Result.fail("系统异常");
        } else {
            return Result.success("删除成功");
        }
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值