ssm601基于ssm框架的校园闲置物品交易平台+jsp【已测试】

前言:👩‍💻 计算机行业的同仁们,大家好!作为专注于Java领域多年的开发者,我非常理解实践案例的重要性。以下是一些我认为有助于提升你们技能的资源:

👩‍💻 SpringBoot的精选案例推介!🔥
👩‍💻 想要把握小程序开发的精髓?这里有你需要的优选案例!🚀

点开文末链接,即可获取这些精品案例的源码。分享知识,共同进步!👇👇
📚 掌握这些案例,让你的编程之路更加顺畅。立即查看详情和获取源码!

希望这些资料能帮助你们在技术旅程中更进一步!🌟


项目名

 ssm601基于ssm框架的校园闲置物品交易平台+jsp【已测试】
技术栈

 
SpringBoot+Vue+小程序+MySQL+Maven


一、-环境介绍

1.1 运行环境

 
开发语言:Java
数据库:MySQL
系统架构:B/S
后端:SpringBoot(MyBatis)
前端:Vue
工具:IDEA,JDK1.8,Maven

二、ssm601基于ssm框架的校园闲置物品交易平台+jsp【已测试】-系统介绍

 
2.1 项目介绍

现代经济快节奏发展以及不断完善升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本校园闲置物品交易平台就是在这样的大环境下诞生,其可以帮助管理者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以帮助管理人员提高事务处理效率,达到事半功倍的效果。此校园闲置物品交易平台利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了收货地址管理、购物车管理、字典管理、论坛管理、公告信息管理、商家管理、物品管理、物品收藏管理、物品评价管理、物品留言管理、物品订单管理、用户管理、管理员管理等功能。校园闲置物品交易平台的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。

关键词:校园闲置物品交易平台;SSM框架;Mysql;自动化

2.2 功能模块

 


三、ssm601基于ssm框架的校园闲置物品交易平台+jsp【已测试】-系统展示

 
3.1部分功能图文展示


四、ssm601基于ssm框架的校园闲置物品交易平台+jsp【已测试】-部分代码设计

 
4.1.部分代码如下:


package com.controller;

import java.io.File;
import java.math.BigDecimal;
import java.net.URL;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.*;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.entity.*;
import com.entity.view.*;
import com.service.*;
import com.utils.PageUtils;
import com.utils.R;
import com.alibaba.fastjson.*;

/**
 * 物品评价
 * 后端接口
 * @author
 * @email
*/
@RestController
@Controller
@RequestMapping("/wupinCommentback")
public class WupinCommentbackController {
    private static final Logger logger = LoggerFactory.getLogger(WupinCommentbackController.class);

    @Autowired
    private WupinCommentbackService wupinCommentbackService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;

    //级联表service
    @Autowired
    private WupinService wupinService;
    @Autowired
    private YonghuService yonghuService;



    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永不会进入");
        else if("用户".equals(role))
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        else if("商家".equals(role))
            params.put("shangjiaId",request.getSession().getAttribute("userId"));
        if(params.get("orderBy")==null || params.get("orderBy")==""){
            params.put("orderBy","id");
        }
        PageUtils page = wupinCommentbackService.queryPage(params);

        //字典表数据转换
        List<WupinCommentbackView> list =(List<WupinCommentbackView>)page.getList();
        for(WupinCommentbackView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c, request);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        WupinCommentbackEntity wupinCommentback = wupinCommentbackService.selectById(id);
        if(wupinCommentback !=null){
            //entity转view
            WupinCommentbackView view = new WupinCommentbackView();
            BeanUtils.copyProperties( wupinCommentback , view );//把实体数据重构到view中

                //级联表
                WupinEntity wupin = wupinService.selectById(wupinCommentback.getWupinId());
                if(wupin != null){
                    BeanUtils.copyProperties( wupin , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setWupinId(wupin.getId());
                }
                //级联表
                YonghuEntity yonghu = yonghuService.selectById(wupinCommentback.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view, request);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody WupinCommentbackEntity wupinCommentback, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,wupinCommentback:{}",this.getClass().getName(),wupinCommentback.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(false)
            return R.error(511,"永远不会进入");
        else if("用户".equals(role))
            wupinCommentback.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));

        wupinCommentback.setInsertTime(new Date());
        wupinCommentback.setCreateTime(new Date());
        wupinCommentbackService.insert(wupinCommentback);
        return R.ok();
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody WupinCommentbackEntity wupinCommentback, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,wupinCommentback:{}",this.getClass().getName(),wupinCommentback.toString());

        String role = String.valueOf(request.getSession().getAttribute("role"));
//        if(false)
//            return R.error(511,"永远不会进入");
//        else if("用户".equals(role))
//            wupinCommentback.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
        //根据字段查询是否有相同数据
        Wrapper<WupinCommentbackEntity> queryWrapper = new EntityWrapper<WupinCommentbackEntity>()
            .eq("id",0)
            ;

        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        WupinCommentbackEntity wupinCommentbackEntity = wupinCommentbackService.selectOne(queryWrapper);
        wupinCommentback.setUpdateTime(new Date());
        if(wupinCommentbackEntity==null){
            wupinCommentbackService.updateById(wupinCommentback);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"表中有相同数据");
        }
    }

    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        wupinCommentbackService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }


    /**
     * 批量上传
     */
    @RequestMapping("/batchInsert")
    public R save( String fileName){
        logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
        try {
            List<WupinCommentbackEntity> wupinCommentbackList = new ArrayList<>();//上传的东西
            Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
            Date date = new Date();
            int lastIndexOf = fileName.lastIndexOf(".");
            if(lastIndexOf == -1){
                return R.error(511,"该文件没有后缀");
            }else{
                String suffix = fileName.substring(lastIndexOf);
                if(!".xls".equals(suffix)){
                    return R.error(511,"只支持后缀为xls的excel文件");
                }else{
                    URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
                    File file = new File(resource.getFile());
                    if(!file.exists()){
                        return R.error(511,"找不到上传文件,请联系管理员");
                    }else{
                        List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
                        dataList.remove(0);//删除第一行,因为第一行是提示
                        for(List<String> data:dataList){
                            //循环
                            WupinCommentbackEntity wupinCommentbackEntity = new WupinCommentbackEntity();
//                            wupinCommentbackEntity.setWupinId(Integer.valueOf(data.get(0)));   //物品 要改的
//                            wupinCommentbackEntity.setYonghuId(Integer.valueOf(data.get(0)));   //用户 要改的
//                            wupinCommentbackEntity.setWupinCommentbackText(data.get(0));                    //评价内容 要改的
//                            wupinCommentbackEntity.setInsertTime(date);//时间
//                            wupinCommentbackEntity.setReplyText(data.get(0));                    //回复内容 要改的
//                            wupinCommentbackEntity.setUpdateTime(new Date(data.get(0)));          //回复时间 要改的
//                            wupinCommentbackEntity.setCreateTime(date);//时间
                            wupinCommentbackList.add(wupinCommentbackEntity);


                            //把要查询是否重复的字段放入map中
                        }

                        //查询是否重复
                        wupinCommentbackService.insertBatch(wupinCommentbackList);
                        return R.ok();
                    }
                }
            }
        }catch (Exception e){
            return R.error(511,"批量插入数据异常,请联系管理员");
        }
    }





    /**
    * 前端列表
    */
    @IgnoreAuth
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));

        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = wupinCommentbackService.queryPage(params);

        //字典表数据转换
        List<WupinCommentbackView> list =(List<WupinCommentbackView>)page.getList();
        for(WupinCommentbackView c:list)
            dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id, HttpServletRequest request){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        WupinCommentbackEntity wupinCommentback = wupinCommentbackService.selectById(id);
            if(wupinCommentback !=null){


                //entity转view
                WupinCommentbackView view = new WupinCommentbackView();
                BeanUtils.copyProperties( wupinCommentback , view );//把实体数据重构到view中

                //级联表
                    WupinEntity wupin = wupinService.selectById(wupinCommentback.getWupinId());
                if(wupin != null){
                    BeanUtils.copyProperties( wupin , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setWupinId(wupin.getId());
                }
                //级联表
                    YonghuEntity yonghu = yonghuService.selectById(wupinCommentback.getYonghuId());
                if(yonghu != null){
                    BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
                    view.setYonghuId(yonghu.getId());
                }
                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view, request);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody WupinCommentbackEntity wupinCommentback, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,wupinCommentback:{}",this.getClass().getName(),wupinCommentback.toString());
        wupinCommentback.setInsertTime(new Date());
        wupinCommentback.setCreateTime(new Date());
        wupinCommentbackService.insert(wupinCommentback);
        return R.ok();
        }


}

 表4.1收货地址表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yonghu_id

Integer

创建用户

3

address_name

String

收货人

4

address_phone

String

电话

5

address_dizhi

String

地址

6

isdefault_types

Integer

是否默认地址

7

insert_time

Date

添加时间

8

update_time

Date

修改时间

9

create_time

Date

创建时间

表4.2购物车表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yonghu_id

Integer

所属用户

3

wupin_id

Integer

物品

4

buy_number

Integer

购买数量

5

create_time

Date

添加时间

6

update_time

Date

更新时间

7

insert_time

Date

创建时间

表4.3字典表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

dic_code

String

字段

3

dic_name

String

字段名

4

code_index

Integer

编码

5

index_name

String

编码名字

6

super_id

Integer

父字段id

7

beizhu

String

备注

8

create_time

Date

创建时间

表4.4论坛表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

forum_name

String

帖子标题

3

yonghu_id

Integer

用户

4

shangjia_id

Integer

商家

5

users_id

Integer

管理员

6

forum_content

String

发布内容

7

super_ids

Integer

父id

8

forum_types

Integer

帖子类型

9

forum_state_types

Integer

帖子状态

10

insert_time

Date

发帖时间

11

update_time

Date

修改时间

12

create_time

Date

创建时间

表4.5公告信息表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

gonggao_name

String

公告名称

3

gonggao_photo

String

公告图片

4

gonggao_types

Integer

公告类型

5

insert_time

Date

公告发布时间

6

gonggao_content

String

公告详情

7

create_time

Date

创建时间

表4.6商家表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

shangjia_name

String

商家名称

3

shangjia_phone

String

联系方式

4

shangjia_email

String

邮箱

5

shangjia_photo

String

商家头像

6

shangjia_xingji_types

Integer

商家信用类型

7

shangjia_content

String

商家简介

8

shangjia_delete

Integer

逻辑删除

9

create_time

Date

创建时间

表4.7物品表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

shangjia_id

Integer

商家

3

wupin_name

String

物品名称

4

wupin_photo

String

物品照片

5

wupin_types

Integer

物品类型

6

wupin_kucun_number

Integer

物品库存

7

wupin_old_money

BigDecimal

物品原价

8

wupin_new_money

BigDecimal

现价

9

wupin_clicknum

Integer

点击次数

10

wupin_content

String

物品简介

11

shangxia_types

Integer

是否上架

12

wupin_delete

Integer

逻辑删除

13

create_time

Date

创建时间

表4.8物品收藏表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

wupin_id

Integer

物品

3

yonghu_id

Integer

用户

4

wupin_collection_types

Integer

类型

5

insert_time

Date

收藏时间

6

create_time

Date

创建时间

表4.9物品评价表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

wupin_id

Integer

物品

3

yonghu_id

Integer

用户

4

wupin_commentback_text

String

评价内容

5

insert_time

Date

评价时间

6

reply_text

String

回复内容

7

update_time

Date

回复时间

8

create_time

Date

创建时间

表4.10物品留言表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

wupin_id

Integer

物品

3

yonghu_id

Integer

用户

4

wupin_liuyan_text

String

留言内容

5

insert_time

Date

留言时间

6

reply_text

String

回复内容

7

update_time

Date

回复时间

8

create_time

Date

创建时间

表4.11物品订单表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

wupin_order_uuid_number

String

订单号

3

address_id

Integer

收获地址

4

wupin_id

Integer

物品

5

yonghu_id

Integer

用户

6

buy_number

Integer

购买数量

7

wupin_order_true_price

BigDecimal

实付价格

8

wupin_order_courier_name

String

快递公司

9

wupin_order_courier_number

String

订单快递单号

10

wupin_order_types

Integer

订单类型

11

wupin_order_payment_types

Integer

支付类型

12

insert_time

Date

订单创建时间

13

create_time

Date

创建时间

表4.12用户表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

yonghu_name

String

用户姓名

3

yonghu_phone

String

用户手机号

4

yonghu_id_number

String

用户身份证号

5

yonghu_photo

String

用户头像

6

yonghu_email

String

电子邮箱

7

create_time

Date

创建时间

表4.13管理员表

序号

列名

数据类型

说明

允许空

1

Id

Int

id

2

username

String

用户名

3

password

String

密码

4

role

String

角色

5

addtime

Date

新增时间


五、ssm601基于ssm框架的校园闲置物品交易平台+jsp【已测试】-结束语

        通过对校园闲置物品交易平台的开发,让我深刻明白开发一个程序软件需要经历的流程,当确定要开发一个校园闲置物品交易平台的程序时,我在开发期间,对其功能进行合理的需求分析,然后才是程序软件的功能的框架设计,数据库的实体与数据表设计,程序软件的功能详细界面实现,以及程序的功能测试等进行全方位的细致考虑,虽然在此过程中,各个环节都遇到了大大小小的困难,但是通过对这些问题进行反复的分析,深入的思考,借助各种相关文献资料提供的方法与解决思路成功解决面临的各个问题,最后成功的让我开发的校园闲置物品交易平台得以正常运行。

校园闲置物品交易平台在功能上面是基本可以满足用户对系统的操作,但是这个程序软件也有许多方面是不足的,因此,在下一个时间阶段,有几点需要改进的地方需要提出来,它们分别是:

(1)操作页面可以满足用户简易操作的要求,但是在页面多样化设计层面上需要把一些比较丰富的设计结构考虑进来。

(2)程序软件的总体安全性能需要优化,例如程序的退出安全性,以及程序的并发性等问题都需要进行安全性升级,让开发的校园闲置物品交易平台与现实中的相关网站更贴合。

(3)需要对程序的数据结构方面,程序的代码方面等进行优化,让运行起来的程序可以保持稳定运行,也让程序能够保证短时间内处理相关事务,节省处理事务的时间,提高事务处理的效率,同时对服务器上资源占用的比例进行降低。

校园闲置物品交易平台的开发一方面是对自身专业知识技能进行最终考核,另一方面也是让自己学会独立解决程序开发过程中所遇到的问题,掌握将理论知识运用于程序开发实践的方法。校园闲置物品交易平台的开发最终目标就是让系统更具人性化,同时在逻辑设计上,让系统能够更加的严谨。


 

  • 23
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值