Java项目:119SpringBoot废品回收系统

本文介绍了使用SpringBoot和Mybatis开发的废品回收系统,包括前后端功能、技术架构、安装步骤,以及展示了一个商户订单管理和用户管理的示例代码片段。
摘要由CSDN通过智能技术生成

博主主页:Java旅途
简介:分享计算机知识、学习路线、系统源码及教程
文末获取源码

一、项目介绍

废品回收系统是由SpringBoot+Mybatis开发的,分为前台和后台,前台进行下单,后台处理。

后台功能如下:

  • 类型管理
  • 商品管理
  • 会员管理
  • 商户管理
  • 订单管理
  • 预约管理

前台功能如下:

  • 注册登录

  • 上门回收预约

  • 回收订单

  • 环保商城

  • 我的订单

  • 购物车

  • 个人中心

  • 下单

  • 付款

  • 确认收货

二、技术框架

  • 后端:SpringBoot,Mybatis
  • 前端:bootstrap,jquery

三、安装教程

  1. 用idea打开项目

  2. 在idea中配置jdk环境

  3. 配置maven环境并下载依赖

  4. 新建数据库,导入数据库文件

  5. 在application.yml文件中将数据库账号密码改成自己本地的

  6. 启动运行

四、项目截图

image-20230719153803411

image-20230719154340996

image-20230719154401759

image-20230719154429532

image-20230719154443070

image-20230719154454364

image-20230719154516527

五、相关代码

OrderManager

package com.soft.action.business;

import com.soft.model.*;
import com.soft.service.*;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;

/**
 * @program: garbgeSpringboot
 * @description: 商户订单管理
 **/
@Controller
@RequestMapping("business/orderManager")
public class OrderManager {

    @Autowired
    private GarbageOrderService garbageOrderService;

    @Autowired
    private AddressService addressService;

    @Autowired
    private GarbageTypeService garbageTypeService;

    @Autowired
    private SalesService salesService;


    @Autowired
    private UserService userService;

    // 跳转到废品回收订单管理界面
    @RequestMapping("/toOrderManager")
    public String toGarbageOrderManager(Map<String, Object> map) {

        List<GarbageOrder> garbageOrderList = garbageOrderService.getAllWaitGet();

        map.put("garbageOrderList", garbageOrderList);

        List<GarbageType> garbageTypeList = garbageTypeService.getAll();
        List<Address> addresses = addressService.getAll();

        map.put("garbageOrderList", garbageOrderList);
        map.put("addresses", addresses);
        map.put("garbageTypeList", garbageTypeList);

        return "business/garbageOrderManager";
    }

    // 跳转到废品回收订单管理界面
    @RequestMapping("/toAssigenSaler")
    public String toAssigenSaler(Map<String, Object> map, HttpSession session,@RequestParam("orderId")Integer orderId) {


        Business business = (Business) session.getAttribute("admin");
        Integer businessId = business.getId();
        List<Sales> salesList = salesService.getAll(businessId);

        map.put("salesList", salesList);
        map.put("orderId", orderId);

        return "business/saleList";
    }

    @RequestMapping(value = "/getGarbageOrder", method = RequestMethod.GET)
    public void getGarbageOrder(Map<String, Object> map, HttpSession session, HttpServletResponse response, @RequestParam("id") Integer id) throws IOException {

        PrintWriter out = response.getWriter();
        List<GarbageOrder> garbageOrderList = garbageOrderService.getAllWaitGet();


        Business business = (Business) session.getAttribute("admin");
        GarbageOrder garbageOrder = new GarbageOrder();

        garbageOrder.setId(id);
        garbageOrder.setStatus(2);
        garbageOrder.setBusinessId(business.getId());


        int result = garbageOrderService.updateSelective(garbageOrder);

        map.put("garbageOrderList", garbageOrderList);

        List<GarbageType> garbageTypeList = garbageTypeService.getAll();
        List<Address> addresses = addressService.getAll();

        map.put("garbageOrderList", garbageOrderList);
        map.put("addresses", addresses);
        map.put("garbageTypeList", garbageTypeList);

        // 添加废品上门回收订单
        if (result == 1) {
            System.out.println("抢单成功!");
            out.write("<script>alert('抢单成功!');"
                    + "window.location.href='/garbage-collection/business/orderManager/toOrderManager'</script>");
        } else {
            System.out.println("抢约失败!");
            out.write("<script>alert('抢单失败!');"
                    + "window.location.href='/garbage-collection/business/orderManager/toOrderManager'</script>");
        }
    }

    /**
     * 委派回收员
     */
    @RequestMapping(value = "/assigneSaler/{orderId}", method = RequestMethod.GET)
    public void assigneSaler(Map<String, Object> map, HttpSession session, HttpServletResponse response,
                             @PathVariable("orderId") Integer orderId,
                             @RequestParam("userId") Integer userId) throws IOException {

        PrintWriter out = response.getWriter();

        Business business = (Business) session.getAttribute("admin");
        GarbageOrder garbageOrder = new GarbageOrder();

        garbageOrder.setId(orderId);
        garbageOrder.setSaleId(userId);
        garbageOrder.setStatus(3);


        int result = garbageOrderService.updateSelective(garbageOrder);

        List<Sales> salesList = salesService.getAll(orderId);
        map.put("salesList", salesList);
        // 添加废品上门回收订单
        if (result == 1) {
            System.out.println("委派收货员成功!");
            out.write("<script>alert('委派收货员成功!');"
                    + "window.location.href='/garbage-collection/business/orderManager/toOrderManager'</script>");
        } else {
            System.out.println("委派收货员失败!");
            out.write("<script>alert('委派收货员失败!');"
                    + "window.location.href='/garbage-collection/business/orderManager/toOrderManager'</script>");
        }

    }

}

SalesManagerAction

package com.soft.action.business;

import com.soft.model.Business;
import com.soft.model.Sales;
import com.soft.model.User;
import com.soft.service.AddressService;
import com.soft.service.GarbageTypeService;
import com.soft.service.SalesService;
import com.soft.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @Description: 商户管理回收员控制器
 */
@Controller
@RequestMapping("/business/salesManager")
public class SalesManagerAction {

    @Autowired
    private SalesService userService;

    // 跳转到会员管理界面
    @RequestMapping("/toUserManager")
    public String toUserManager(Map<String, Object> map, HttpSession session) {

        Business business = (Business)session.getAttribute("admin");

        List<Sales> users = userService.getAll(business.getId());
        map.put("users", users);
        return "business/salePersonManager";

    }

    // 查询
    @RequestMapping("/search")
    public String search(String username, Map<String, Object> map, HttpServletResponse response) throws IOException {
        PrintWriter out = response.getWriter();

        if (username != null && !"".equals(username)) {
            Sales user = userService.getByUserName(username);
            if (user == null) {
                System.out.println("用户不存在!");
                out.write(
                        "<script>alert('回收员不存在!');" + "window.location.href='/garbage-collection/salesManager/toUserManager'</script>");
            } else {
                List<Sales> users = new ArrayList<Sales>();
                users.add(user);
                map.put("users", users);
                return "business/salePersonManager";
            }

        } else {
            return "redirect:toUserManager";
        }
        return "redirect:toUserManager";
    }


    // 修改
    @RequestMapping("/update")
    public String update(User user) {
        if (user != null) {
            // 这个是更新入库的user
            Sales newUser = userService.getById(user.getId());

            if (user.getUsername() != null && !"".equals(user.getUsername())) {
                newUser.setUsername(user.getUsername());
                System.out.println("修改了用户名");
            }
            if (user.getPassword() != null && !"".equals(user.getPassword())) {
                newUser.setPassword(user.getPassword());
                System.out.println("修改了密码");
            }
            if (user.getMoney() != null) {
                //newUser.setMoney(user.getMoney());
                System.out.println("修改了积分");
            }
            userService.update(newUser);
        }
        return "redirect:toUserManager";
    }

    @RequestMapping("/delete")
    public String delete(Integer id) {
        userService.delete(id);
        return "redirect:toUserManager";
    }
}

大家点赞、收藏、关注、评论啦 、👇🏻点开下方卡片👇🏻关注后回复 104

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Java旅途

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

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

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

打赏作者

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

抵扣说明:

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

余额充值