基于javaweb+mysql的二手交易平台二手商城二手物品(前台、后台)

2023-10-27

基于javaweb+mysql的二手交易平台二手商城二手物品(前台、后台)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

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

适用

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

功能说明

前台用户:注册、登录、个人信息修改、查询商品、发布和修改商品、收藏、购买、评价等……

后台管理员:登录、分类管理、物品管理、订单管理、用户管理等……

前台用户:

后台管理员:

技术框架

JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) MySQL JavaScript CSS Bootstrap……


适用

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

				<div id="review-bar" class="col-md-6 rev1-bar" align="center"
					onclick="reviewButton()">
					<B style="font-size: 16px; color: #c4c4c4">收到的评论</B>
				</div>
				
				<div id="reply-bar" class="col-md-6 rev2-bar" align="center"
					onclick="replyButton()">
					<B style="font-size: 16px; color: #c4c4c4">收到的回复</B>
				</div>
			</div>
			
			<div class="col-md-12 r2"
				style="background-color: #f9f9f9; padding-bottom: 15px">
				<div id="review-body" class="col-md-12 r3"
					style="display: none; overflow-y: auto; height: 585px; background-color: #ffffff; padding-left: 5px; padding-right: 5px; padding-top: 5px; padding-bottom: 15px;">
					<c:choose>
						<c:when test="${reviews.size() == 0}">
							<div class="col-md-12" align="center"
								style="background-color: #ffffff; margin-top: 150px">
								<img src="<c:url value="/statics/image/logo/yihan.png"/>"
									width="95%" ; height="170px;">
								<p style="color: #c4c4c4; font-size: 16px">抱歉,暂无评论消息!</p>
							</div>
    function disableUser(userId) {
        var dblChoseAlert = simpleAlert({
            "content": "确认禁用用户? 用户id:"+userId,
            "buttons":{
                "确定":function () {
                    dblChoseAlert.close();
                    setUserStatus(5, userId);
                },
                "取消":function () {
                    dblChoseAlert.close();
                }
            }
        })
    }

    function deleteUser(userId) {
        var dblChoseAlert = simpleAlert({
            "content": "确认禁用用户? 用户id:"+userId,
		}
		System.out.println(user.getMobile());
		System.out.println(status);
		model.addAttribute("user", user);
		model.addAttribute("status", status);
		return "home/register";
	}
}
package com.demo.controller;

import com.demo.model.FirstType;
import com.demo.model.SecondType;
import com.demo.service.GoodService;
import com.demo.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
		List<Good> goods = goodService.getGoodByUserId(user.getId());
		List<Order> orders = orderService.getOrderByCustomerId(user.getId());
		List<Review> reviews = reviewService.gerReviewByToUserId(user.getId());
		List<Reply> replies = reviewService.gerReplyByToUserId(user.getId());
		List<Order> sellGoods = orderService.getOrderBySellerId(user.getId());
		model.addAttribute("collects", collects);
		model.addAttribute("goods", goods);
		model.addAttribute("orders", orders);
		model.addAttribute("reviews", reviews);
		model.addAttribute("replies", replies);
		model.addAttribute("sellGoods", sellGoods);
		return "user/userProfile";
	}

	@RequestMapping(value = "/review", method = RequestMethod.GET)
	public String getReviewInfo(@RequestParam(required = false) Integer goodId,
			@RequestParam(required = false) Integer reviewId) {
		System.out.println("reviewId" + reviewId);
		if (reviewId != null) {
			System.out.println("reviewId" + reviewId);
			if (reviewService.updateReviewStatus(1, reviewId) == 1) {
				return "redirect:/goods/goodInfo?goodId=" + goodId;
			}
		}
		return "redirect:/user/userProfile";
				"newPassword" : password
			};
			console.log(oldPassword);
			console.log(pass)
			if (password !== passwordConfirm) {
				document.getElementById("passError").innerHTML = "对不起,您2次输入的密码不一致";
			} else if (oldPassword === "" || password === "") {
				document.getElementById("passError").innerHTML = "对不起,不可以为空!";
			} else {
				document.getElementById("passError").innerHTML = "";
				$.ajax({
					type : "POST",
					url : "/secondshop/user/password/edit",
					contentType : "application/json; charset=UTF-8", //必须这样写
					dataType : "json",
					data : JSON.stringify(pass),//要提交是json字符串
					success : function(data) {
						if (data === true) {
							alert("密码修改成功!");
						} else {
			style="background-color: #d2d2d2; height: 92%; padding: 0px;">
			<div style="float: right; width: 100%;">
				<div id="menu1" onclick="menuBar('menu1')" class="admenu-b"
					align="center">
					<p>
						<B style="font-size: 20px; color: #5c5c5c; cursor: pointer">物品分类管理</B>
					</p>
				</div>
				
				<div id="menu2" onclick="menuBar('menu2')" class="admenu"
					align="center">
					<p>
						<B style="font-size: 20px; color: #5c5c5c; cursor: pointer">物品管理</B>
					</p>
				</div>
				
				<div id="menu3" onclick="menuBar('menu3')" class="admenu"
					align="center">
					<p>
						<B style="font-size: 20px; color: #5c5c5c; cursor: pointer">订单管理</B>
					</p>
				</div>
				
				<div id="menu4" onclick="menuBar('menu4')" class="admenu"
					align="center">
					<p>
						<B style="font-size: 20px; color: #5c5c5c; cursor: pointer">用户管理</B>
import java.text.SimpleDateFormat;

/**
 * 物品表
 * 
 * @author WEN
 *
 */
public class Good {
	private int id;
	private String name;
	private String photoUrl;
	private int firstTypeId;
	private int secondTypeId;
	private SecondType goodSecondType;
	private String describe;
	private String uploadDate;
	private float prise;
	private int statusId;
	private int userId;
	private User goodUser;
	private String update;
											<th style="width: 100px">状态</th>
											<th>操作</th>
										</tr>
									</thead>
								</table>
							</div>
							
							<div class="col-md-12 column"
								style="overflow-y: auto; height: 280px;">
								<table class="table table-hover">
									<tbody id="collectTable">
										<c:forEach var="collect" items="${collects}">
											<tr style="color: #666666">
												<td style="width: 102px"><a target="_blank"
				// 生成uuid作为文件名称
				String fileName = goodId + randomString.getRandomString(10);
				// 获得文件类型(可以判断如果不是图片,禁止上传)
				String contentType = mf.getContentType();
				// 获得文件后缀名称
				String imageName = contentType.substring(contentType
						.indexOf("/") + 1);
				name = fileName + "." + imageName;
				System.out.println("name:" + name);
				mf.transferTo(new File(pathRoot , name));
				Image image = new Image();
				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) {
                        $("#secondType-ba").append(secondType);
                    });
                    alert("分类添加成功!");
                }
            }

        });
        $("#sec").slideUp();
    }

    function deleteFirst(first_id) {
        $.getJSON("/secondshop/type/firstType/delete/"+first_id, function (data) {
            if (data === false){
                alert("删除失败,请确认该分类下是否还有二级分类!");
            } else {
                document.getElementById("firstType-ba").innerHTML = "";
                $.each(data, function (i, type) {
                    var firstId = type.id;
			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);
				name = fileName + "." + imageName;
				System.out.println("name:" + name);
				mf.transferTo(new File(pathRoot,name));
				Image image = new Image();
				image.setGoodId(goodId);
				image.setName(name);
				image.setUrl(filePath + "/" + name);
				imageService.insertImage(image);
			}
						</div>
						
						<div class="col-md-4">
							<img src="<c:url value="${user.photoUrl}"/>" id="img"
								height="120px" width="120px">
						</div>
					</div>
					
					<spring:bind path="name">
						<div class="form-group">
							<form:label path="name" cssClass="control-label">姓名</form:label>
							<form:input path="name" cssClass="form-control"></form:input>
						</div>
					</spring:bind>
					
					<spring:bind path="gender">
						<div class="form-group">
							<form:label path="gender" cssClass="control-label">性别</form:label>
							<form:select path="gender" id="gender" cssClass="form-control">
								<form:option value=""></form:option>
								<form:option value=""></form:option>
							</form:select>
						</div>
				.isEmpty();
		System.out.println(goodService.getGoodsAdminByType(secondTypeId));
		if (success) {
			Integer thisFirstTypeId = typeService.getSecondTypeById(
					secondTypeId).getFirstTypeId();
			success = typeService.deleteSecondType(secondTypeId);
			if (success) {
				List<SecondType> secondTypeList = typeService
						.getSecondTypeByFirstTypeId(thisFirstTypeId);
				if (secondTypeList == null) {
					return ResponseEntity.ok("isNull");
				}
				return ResponseEntity.ok(secondTypeList);
			}
		}
		return ResponseEntity.ok(success);
	}

	@RequestMapping(value = "/firstType/delete/{firstTypeId}", method = RequestMethod.GET)
		List<FirstType> firstTypes = typeService.getAllFirstType();
		User user = (User) session.getAttribute("user");
		if (user == null) {
			return "redirect:/";
		}
		List<Good> goods = goodService.getAllGoods(0, 5);
		if (!(goodService.updateGood(good) > 0)) {
			System.out.println("修改物品失败!");
		}
		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,
			@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();

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

基于javaweb+mysql的二手交易平台二手商城二手物品(前台、后台) 的相关文章

  • 学说迁移后备

    我们正在使用原则迁移 当迁移包含多个操作并且其中一个操作失败时 通常会出现问题 例如 如果迁移添加了 5 个外键 其中第 5 个失败 而字段长度不同 则修复字段错误并重新生成迁移不会not修复整个问题 而现在出现一个与 4 个密钥已存在有关
  • 如何在 Spring 中禁用使用 @Component 注释创建 bean?

    我的项目中有一些用于重构逻辑的通用接口 它看起来大约是这样的 public interface RefactorAwareEntryPoint default boolean doRefactor if EventLogService wa
  • 如何获取之前的URL?

    我需要调用我的网络应用程序的 URL 例如 如果有一个从 stackoverflow com 到我的网站 foo com 的链接 我需要 Web 应用程序 托管 bean 中的 stackoverflow 链接 感谢所有帮助 谢谢 并不总是
  • 来自 dll 的 Java 调用函数

    我有这个 python 脚本导入zkemkeeperdll 并连接到考勤设备 ZKTeco 这是我正在使用的脚本 from win32com client import Dispatch zk Dispatch zkemkeeper ZKE
  • java.lang.IllegalStateException:应用程序 PagerAdapter 更改了适配器的内容,而没有调用 PagerAdapter#notifyDataSetChanged android

    我正在尝试使用静态类将值传递给视图 而不是使用意图 因为我必须传递大量数据 有时我会收到此错误 但无法找出主要原因是什么 Error java lang IllegalStateException The application s Pag
  • Java 集合的并集或交集

    建立并集或交集的最简单方法是什么Set在 Java 中 我见过这个简单问题的一些奇怪的解决方案 例如手动迭代这两个集合 最简单的单行解决方案是这样的 set1 addAll set2 Union set1 retainAll set2 In
  • 无法创建请求的服务[org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]-MySQL

    我是 Hibernate 的新手 我目前正在使用 Spring boot 框架并尝试通过 hibernate 创建数据库表 我知道以前也问过同样的问题 但我似乎无法根据我的环境找出如何修复错误 休眠配置文件
  • 在 junit 测试中获取 javax.lang.model.element.Element 类

    我想测试我的实用程序类 ElementUtils 但我不知道如何将类作为元素获取 在 AnnotationProcessors 中 我使用以下代码获取元素 Set
  • Hibernate 的 PersistentSet 不使用 hashCode/equals 的自定义实现

    所以我有一本实体书 public class Book private String id private String name private String description private Image coverImage pr
  • Java ResultSet 如何检查是否有结果

    结果集 http java sun com j2se 1 4 2 docs api java sql ResultSet html没有 hasNext 方法 我想检查 resultSet 是否有任何值 这是正确的方法吗 if resultS
  • 如何在谷歌地图android上显示多个标记

    我想在谷歌地图android上显示带有多个标记的位置 问题是当我运行我的应用程序时 它只显示一个位置 标记 这是我的代码 public class koordinatTask extends AsyncTask
  • 在我的 Spring Boot 示例中无法打开版本 3 中的 Swagger UI

    我在 Spring Boot 示例中打开 swagger ui 时遇到问题 当我访问 localhost 8080 swagger ui 或 localhost 8080 root api name swagger ui 时出现这种错误 S
  • SQL 最近日期

    我需要在 php 中获取诸如 2010 04 27 之类的日期作为字符串 并在表中找到最近的 5 个日期 表中的日期保存为日期类型 您可以使用DATEDIFF http dev mysql com doc refman 5 1 en dat
  • logcat 中 mSecurityInputMethodService 为 null

    我写了一点android应显示智能手机当前位置 最后已知位置 的应用程序 尽管我复制了示例代码 并尝试了其他几种解决方案 但似乎每次都有相同的错误 我的应用程序由一个按钮组成 按下按钮应该log经度和纬度 但仅对数 mSecurityInp
  • Eclipse 选项卡宽度不变

    我浏览了一些与此相关的帖子 但它们似乎并不能帮助我解决我的问题 我有一个项目 其中 java 文件以 2 个空格的宽度缩进 我想将所有内容更改为 4 空格宽度 我尝试了 正确的缩进 选项 但当我将几行修改为 4 空格缩进时 它只是将所有内容
  • Eclipse 启动时崩溃;退出代码=13

    I am trying to work with Eclipse Helios on my x64 machine Im pretty sure now that this problem could occur with any ecli
  • 我如何在java中读取二进制数据文件

    因此 我正在为学校做一个项目 我需要读取二进制数据文件并使用它来生成角色的统计数据 例如力量和智慧 它的设置是让前 8 位组成一个统计数据 我想知道执行此操作的实际语法是什么 是不是就像读文本文件一样 这样 File file new Fi
  • 包 javax.el 不存在

    我正在使用 jre6 eclipse 并导入 javax el 错误 包 javax el 不存在 javac 导入 javax el 过来 这不应该是java的一部分吗 谁能告诉我为什么会这样 谢谢 米 EL 统一表达语言 是 Java
  • 长轮询会冻结浏览器并阻止其他 ajax 请求

    我正在尝试在我的中实现长轮询Spring MVC Web 应用程序 http static springsource org spring docs 2 0 x reference mvc html但在 4 5 个连续 AJAX 请求后它会
  • 使用 svn 1.8.x、subclise 1.10 的 m2e-subclipse 连接器在哪里?

    我读到 m2e 的生产商已经停止生产 svn 1 7 以外的任何版本的 m2e 连接器 Tigris 显然已经填补了维护 m2e subclipse 连接器的空缺 Q1 我的问题是 使用 svn 1 8 x 的 eclipse 更新 url

随机推荐