基于javaweb和mysql的ssm校园二手商城系统(java+ssm+jsp+jquery+h-ui+mysql)

私信源码获取及调试交流

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM校园二手商城系统(java+ssm+jsp+jquery+h-ui+mysql)

项目介绍

该校园二手交易系统主要分为前台和后台两大模块,共包含两种角色,分别是:用户和管理员

具体功能如下: 1.前台功能模块 前台首页、网站公告、商品分类展示、商品搜索、商品详情、加入购物车、支付购买、用户注册、用户登录、个人中心、发布商品、我的商品、我的销售、我的订单、意见反馈、修改密码等功能。

2.后台管理模块 系统后台登陆、管理员信息管理、用户信息管理、新闻公告管理、商品类别管理、商品信息管理、订单信息管理、评价信息管理、意见反馈管理等功能。

环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目 6.数据库:MySql 5.7/8.0等版本均可;

技术栈

后台框架:Spring、SpringMVC、MyBatis UI界面:JSP、jQuery 、H-ui 数据库:MySQL

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;

  2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;


Boolean success = userService.deleteUser(userId);

if (success){

List<User> userList = userService.getAllUser();

return ResponseEntity.ok(userList);

return ResponseEntity.ok(success);

商品控制层:

@Controller

public class GoodController {

private final GoodService goodService;

private final TypeService typeService;

private final ReviewService reviewService;

private final UserService userService;
if (reviewText.equals("")) {

if (replyText.equals("")) {

message = "内容不能为空!";

return "redirect:/goods/goodInfo?goodId=" + goodId;

} else {

Reply reply = new Reply();

reply.setReviewId(reviewId);

reply.setFromUser(fromUser);

reply.setFromUserId(fromUserId);

reply.setToUser(toUser);

reply.setToUserId(toUserId);

reply.setText(replyText);

if (reviewService.insertReply(reply) == 1) {

message = "回复成功!";


@RequestMapping(value = "/adminLogin", method = RequestMethod.POST)

public String postAdminLogin(ModelMap model,

@RequestParam(value = "email", required = false) String email,

@RequestParam(value = "password", required = false) String password,

HttpSession session) {

User admin = userService.getUserByEmail(email);

String message;

if (admin != null){

String mdsPass = DigestUtils.md5DigestAsHex((password + admin.getCode()).getBytes());

//            if (!mdsPass .equals(admin.getPassword())){

//                message = "用户密码错误!";


String imageName = contentType

.substring(contentType.indexOf("/") + 1);

name = fileName + "." + imageName;

mainFile.transferTo(new File(pathRoot + name));

String photoUrl = filePath + "/" + name;

goodService.updateGoodPhotoUrl(photoUrl, goodId);

for (MultipartFile mf : file) {

if (!mf.isEmpty()) {

String contentType = mf.getContentType();

String fileName = goodId + randomString.getRandomString(10);

String imageName = contentType.substring(contentType

.indexOf("/") + 1);


this.goodService = goodService;

this.typeService = typeService;

this.orderService = orderService;

@RequestMapping(value = "/adminLogin", method = RequestMethod.GET)

public String getAdminLogin(){

return "admin/adminLogin";

@RequestMapping(value = "/adminLogin", method = RequestMethod.POST)

public String postAdminLogin(ModelMap model,

@RequestParam(value = "email", required = false) String email,

@RequestParam(value = "password", required = false) String password,

HttpSession session) {

User admin = userService.getUserByEmail(email);


model.addAttribute("firstTypes", firstTypes);

return "goods/publishGood";

@RequestMapping(value = "/goods/publishGood", method = RequestMethod.POST)

public String getGoodId(ModelMap model, HttpSession session,

@Valid Good good) {

List<FirstType> firstTypes = typeService.getAllFirstType();

User user = (User) session.getAttribute("user");

List<Good> goods = goodService.getAllGoods(0, 5);

good.setUserId(user.getId());

good.setPhotoUrl("/statics/image/goods/default/nophoto.png");

if (goodService.insertGood(good) != 1) {

image.setGoodId(goodId);

image.setName(name);

image.setUrl(filePath + "/" + name);

imageService.insertImage(image);

} else {

System.out.println("文件为空!");

return "redirect:/goods/goodInfo?goodId=" + goodId;

@RequestMapping(value = "/goods/userGoods", method = RequestMethod.GET)

public String getUserGoods(ModelMap model,

@RequestParam(value = "userId", required = false) Integer userId) {

User user = userService.getUserById(userId);


List<Good> userGoods = goodService.getGoodStatusByUserId(userId);

List<Good> goods = goodService.getAllGoods(0, 4);

model.addAttribute("user", user);

model.addAttribute("userGoods", userGoods);

model.addAttribute("goods", goods);

return "goods/userGood";

@RequestMapping(value = "/goods/userGoodEdit", method = RequestMethod.GET)

public String getUserGoodEdit(ModelMap model,

@RequestParam(value = "goodId", required = false) Integer goodId,

HttpSession session) {

User user = (User) session.getAttribute("user");

if (reviewText.equals("")) {

if (replyText.equals("")) {

message = "内容不能为空!";

return "redirect:/goods/goodInfo?goodId=" + goodId;

} else {

Reply reply = new Reply();

reply.setReviewId(reviewId);

reply.setFromUser(fromUser);

reply.setFromUserId(fromUserId);

reply.setToUser(toUser);

reply.setToUserId(toUserId);

reply.setText(replyText);

if (reviewService.insertReply(reply) == 1) {

@RequestMapping(value = "/goods/publishGood/uploadImage", method = RequestMethod.POST)

public String uploadImage(

HttpSession session,

@RequestParam(value = "goodId", required = false) Integer goodId,

@RequestParam(value = "mainFile", required = false) MultipartFile mainFile,

@RequestParam(value = "file", required = false) MultipartFile[] file)

throws IOException {

User user = (User) session.getAttribute("user");

FileCheck fileCheck = new FileCheck();

RandomString randomString = new RandomString();

String filePath = "/statics/image/goods/" + user.getId() + "/" + goodId;

String pathRoot = fileCheck.checkGoodFolderExist(filePath);

String name;

if (!mainFile.isEmpty()) {

List<Image> goodImages = imageService.getImageByGoodId(good.getId());

model.addAttribute("goods", goods);

model.addAttribute("good", good);

model.addAttribute("goodImages", goodImages);

model.addAttribute("firstTypes", firstTypes);

return "goods/userGoodEdit";

@RequestMapping(value = "/goods/userGoodEdit/updateImage", method = RequestMethod.POST)

public String updateImage(

HttpSession session,

@RequestParam(value = "goodId", required = false) Integer goodId,


this.goodService = goodService;

this.typeService = typeService;

this.reviewService = reviewService;

this.userService = userService;

this.imageService = imageService;

this.collectService = collectService;

@RequestMapping(value = "/", method = RequestMethod.GET)

public String getHomeGoods(

ModelMap model,

@RequestParam(required = false, defaultValue = "") String searchText,

@RequestParam(required = false) Integer secondTypeId,


model.addAttribute("good", good);

model.addAttribute("goodImages", goodImages);

model.addAttribute("firstTypes", firstTypes);

return "goods/userGoodEdit";

@RequestMapping(value = "/goods/userGoodEdit/updateImage", method = RequestMethod.POST)

public String updateImage(

HttpSession session,

@RequestParam(value = "goodId", required = false) Integer goodId,

@RequestParam(value = "mainFile", required = false) MultipartFile mainFile,

@RequestParam(value = "file", required = false) MultipartFile[] file)

throws IOException {

User user = (User) session.getAttribute("user");

FileCheck fileCheck = new FileCheck();

List<Good> goodList = goodService.getAllGoodList();

for (Good good : goodList) {

good.setGoodUser(userService.getUserById(good.getUserId()));

good.setGoodSecondType(typeService.getSecondTypeById(good

.getSecondTypeId()));

return ResponseEntity.ok(goodList);

订单控制层:

@Controller

public class OrderController {

private final GoodService goodService;

private final OrderService orderService;


public class AdminController {

private final UserService userService;

private final GoodService goodService;

private final TypeService typeService;

private final OrderService orderService;

@Autowired

public AdminController(UserService userService, GoodService goodService, TypeService typeService, OrderService orderService) {

this.userService = userService;

this.goodService = goodService;

this.typeService = typeService;


this.userService = userService;

this.imageService = imageService;

this.collectService = collectService;

@RequestMapping(value = "/", method = RequestMethod.GET)

public String getHomeGoods(

ModelMap model,

@RequestParam(required = false, defaultValue = "") String searchText,

@RequestParam(required = false) Integer secondTypeId,

@RequestParam(required = false, defaultValue = "0") int offset,

@RequestParam(required = false, defaultValue = "40") int limit) {

List<Good> goods = goodService.getGoodsBySearchAndType(searchText,

secondTypeId, offset, limit);

double goodsNum = goodService.getGoodsBySearchAndTypeCount(searchText,


private final UserService userService;

private final ImageService imageService;

private final CollectService collectService;

private static String message = "";

@Autowired

public GoodController(GoodService goodService, TypeService typeService,

ReviewService reviewService, UserService userService,

ImageService imageService, CollectService collectService) {

this.goodService = goodService;

this.typeService = typeService;


public GoodController(GoodService goodService, TypeService typeService,

ReviewService reviewService, UserService userService,

ImageService imageService, CollectService collectService) {

this.goodService = goodService;

this.typeService = typeService;

this.reviewService = reviewService;

this.userService = userService;

this.imageService = imageService;

this.collectService = collectService;

@RequestMapping(value = "/", method = RequestMethod.GET)

public String getHomeGoods(

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐