基于SSM的书画拍卖网站

news2024/9/21 20:46:15

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:采用JSP技术开发
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


前言

基于SSM的书画拍卖网站有管理员和用户两大角色:

管理员:个人中心、用户管理、画作竞拍、拍品类型、画家介绍、竞拍信息、成交订单、发货订单、确认订单、退货订单、系统管理等功能。

用户:首页、画作竞拍、画家介绍、书画界资讯、个人中心、后台管理。

前台首页

 前台首页有首页、画作竞拍、画家介绍、书画界资讯、个人中心、后台管理。

 用户可以选择自己想要竞拍的书画,可以选择竞拍。

 书画界资讯,用户可以查看管理员发布的资讯。

 用户登录页面

 用户注册页面

 用户个人中心页面

 登录以后会出现竞拍按钮,喜欢的可以竞拍

竞拍结果可以点击前台的后台管理,跳转到后台管理中查看自己的竞拍信息、成交订单、发货订单、确认订单、退货订单等信息

竞拍信息中可以查看自己竞拍的书画

管理员功能模块

 管理员后台登录页面。

管理员登录到系统有用户管理、画作竞拍、拍品类型、画家介绍、竞拍信息、成交订单、发货订单、确认订单、退货订单、系统管理等功能。


 用户管理,管理员可以对用户信息进行管理。

 画作竞拍管理,管理员登录后可以对画作竞拍进行管理。

 拍品类型,管理员可以删除或者新增类型。

登录模块核心代码


package com.controller;


import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;

/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }

	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

文件上传核心代码

package com.controller;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;

/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

 封装代码

package com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}

	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}

	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/536097.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

软件系统外包开发流程及注意事项

当企业发展到一定规模后&#xff0c;市场上通用的软件系统往往就无法满足自身的业务需要&#xff0c;这时就需要企业开发属于自己软件系统。软件系统是一项比较复杂的系统工程&#xff0c;从需求分析、代码开发到最后的上线需要比较长的时间&#xff0c;需要有系统的管理方法才…

问题记录:Datax+Datax-web2.1.2的一系列问题

问题1&#xff1a;DataX报错解决办法 - 在有总bps限速条件下&#xff0c;单个channel的bps值不能为空&#xff0c;也不能为非正数 问题原因&#xff1a; 正如中文字面上所说&#xff0c;DataX的配置有问题&#xff0c;单个channel的bps值不能为空&#xff0c;也不能为非正数。…

教你怎么翻译英语语音

在当今全球化的时代&#xff0c;跨语言交流是一种常态。无论你是在国外旅游时无法理解当地人说的英文意思&#xff0c;还是因为职业需要与国外客户、供应商进行交流&#xff0c;这时候通过翻译英文语音就可以帮助你获取对话内容&#xff0c;缩短沟通时间和提升工作效率。那对于…

【windows批处理batch】.bat文件循环判断语句

&#x1f449;博__主&#x1f448;&#xff1a;米码收割机 &#x1f449;技__能&#x1f448;&#xff1a;C/Python语言 &#x1f449;公众号&#x1f448;&#xff1a;测试开发自动化 &#x1f449;专__注&#x1f448;&#xff1a;专注主流机器人、人工智能等相关领域的开发、…

计算机毕业论文内容参考|基于java的学生成绩分析系统的设计与实现

文章目录 导文摘要前言课题背景国内外现状与趋势课题内容相关技术与方法介绍技术分析技术设计系统架构设计数据库设计安全认证设计数据可视化设计技术实现后端实现安全认证实现数据可视化实现总结与展望本文总结后续工作展望导文 基于java的学生成绩分析

【逆向工程核心原理:TLS回调函数】

TLS 代码逆向分析领域中&#xff0c;TLS&#xff08;Thread Local Storage&#xff0c;线程局部存储&#xff09;回调函数&#xff08;Callback Function&#xff09;常用反调试。TLS回调函数的调用运行要先于EP代码的执行&#xff0c;该特征使它可以作为一种反调试技术的使用…

【经验总结】你想知道的BGA焊接问题都在这里

BGA是一种芯片封装的类型&#xff0c;英文 (Ball Grid Array)的简称&#xff0c;封装引脚为球状栅格阵列在封装底部&#xff0c;引脚都成球状并排列成一个类似于格子的图案&#xff0c;由此命名为BGA。 主板控制芯片诸多采用此类封装技术&#xff0c;采用BGA技术封装的内存&am…

聚焦 TimescaleDB VS TDengine 性能对比报告,五大场景全面分析写入与查询

基于第三方基准性能测试平台 TSBS&#xff08;Time Series Benchmark Suite&#xff09; 标准数据集&#xff0c;TDengine 团队分别就 TSBS 指定的 DevOps 中 cpu-only 五个场景&#xff0c;对时序数据库&#xff08;Time Series Database&#xff0c;TSDB&#xff09;Timescal…

ACT:非对称协同训练的半监督域自适应医学图像分割

文章目录 ACT: Semi-supervised Domain-Adaptive Medical Image Segmentation with Asymmetric Co-training摘要本文方法实验结果 ACT: Semi-supervised Domain-Adaptive Medical Image Segmentation with Asymmetric Co-training 摘要 作者建议以统一的方式利用标记的源域和…

nginx实现正向代理

1.下载nginx nginx: download 选择自己需要的版版本下载下来 2.解压文件修改ngixn.conf配置文件 events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout…

MySQL基础(三十六)其他数据库日志

千万不要小看日志。很多看似奇怪的问题&#xff0c;答案往往就藏在日志里。很多情况下&#xff0c;只有通过查看日志才能发现问题的原因&#xff0c;真正解决问题。所以&#xff0c;一定要学会查看日志&#xff0c;养成检查日志的习惯&#xff0c;对提升你的数据库应用开发能力…

【星戈瑞】Sulfo-CY3-COOH磺化/水溶性Cyanine3羧酸1121756-11-3

Sulfo-CY3 COOH是一种荧光染料&#xff0c;其分子结构中含有COOH官能团&#xff0c;最大吸收波长为550纳米左右&#xff0c;可以通过分光光度计等设备进行检测。Sulfo-CY3 COOH是一种带有羧基的荧光染料&#xff0c;可以与含有氨基的生物分子通过偶联反应形成共价键&#xff0c…

TMP的阴影性能如何

1&#xff09;TMP的阴影性能如何 ​2&#xff09;CommandBuffer.DrawMeshInstanced无法画阴影问题 3&#xff09;Unity编辑器在Require大量加载Lua文件时&#xff0c;经常报出not enough memory 4&#xff09;场景制作的时候&#xff0c;2D资源受后处理调色影响比较大 这是第33…

JVM面试题(一)

JVM内存分哪几个区&#xff0c;每个区的作用是什么? java虚拟机主要分为以下几个区: JVM中方法区和堆空间是线程共享的&#xff0c;而虚拟机栈、本地方法栈、程序计数器是线程独享的。 &#xff08;1&#xff09;方法区&#xff1a; a. 有时候也成为永久代&#xff0c;在该区内…

开始梳理大学课程体系(一)--万字C语言总结上

C语言 前言第一章 初识C语言1.1 C语言的起源1.2 选择C语言的理由1.3 使用C语言的7个步骤 第二章 数据和C2.1 变量和常量2.1.1变量定义2.1.2 常量的定义 2.2 数据类型关键字 第三章 运算符、表达式和语句3.1 基本运算符3.1.1 算术运算符3.1.2 关系运算符3.1.3 逻辑运算符3.1.3 赋…

关于接口可维护性的一些建议 | 京东云技术团队

作者&#xff1a;D瓜哥 在做新需求开发或者相关系统的维护更新时&#xff0c;尤其是涉及到不同系统的接口调用时&#xff0c;在可维护性方面&#xff0c;总感觉有很多地方差强人意。一些零星思考&#xff0c;抛砖引玉&#xff0c;希望引发更多的思考和讨论。总结了大概有如下几…

TOB企业生态体系构建的核心要素有哪些?

To B市场作为一个非常庞大的领域&#xff0c;其复杂度和多元化水平&#xff0c;要远远要高于针对于消费者群体推进的市场。尤其近年来&#xff0c;消费互联网成为过去式&#xff0c;爆发式增长的时代结束&#xff0c;让资本、媒体的目光开始聚焦到以B2B企业所代表的产业互联网身…

人工智能与机器人|机器学习

原文链接&#xff1a; https://mp.weixin.qq.com/s/PB_n8woxdsWPtrmL8BbehA 机器学习下包含神经网络、深度学习等&#xff0c;他们之间的关系表示如图2-7所示。 图2-7 关系图 那么什么是机器学习、深度学习、他们的区别又是什么呢&#xff1f; 2.7.1 什么是机器学习&#x…

Unity中Camera.main和Camera.current的区别

在Unity中&#xff0c;Camera.main和Camera.current都是用来获取相机&#xff0c;那到底有什么区别呢&#xff1f; 一、异同及注意事项 1、相同点&#xff1a; Camera.main和Camera.current都是用于获取相机的属性。它们都是静态属性&#xff0c;可以通过Camera类访问。它们…

【Redis】Redis set类型实现点赞功能

文章目录 set 数据类型介绍不排序实现排序实现 set 数据类型介绍 Redis中的set类型是一组无序的字符串值。 set通过其独特的数据结构和丰富的命令提供了在存储和处理集合元素方面的一些非常有用的功能。下面列出了主要的set类型命令&#xff1a; SADD key member1 [member2]&a…