Java project: design and implementation of second-hand trading website (java+ssm+mysql+jsp)

1, Introduction 2

1.1 research background 2

1.2 research purpose and Significance 2

1.3 research contents 3

1.4 feasibility study design 3

1.5 social feasibility 4

1.6 relevant technical description 4

spring 4

SpringĀ 5

jQuery 5

Mysql 6

1) Powerful 6

2) Support cross platform 6

3) Fast running speed 6

4) Support object-oriented 7

5) High security 7

6) Low cost 7

7) Support various development languages 7

8) Large database storage capacity 7

9) Support powerful built-in functions 7

2, Demand analysis 8

2.1 system function overview 8

1) User registration and login function 8

2) User information management 8

3) Operation of user's second-hand items 8

4) User shopping cart management 8

5) User order management operation management 8

6) Management, addition, modification and deletion of idle item types 8

7) Preview and view of web products 8

8) Logout logout 8

2.2 system operation environment 8

3, System design 9

3.1 system design 9

3.1.1 main design of client 9

3.4 main process description 9

4, System implementation 11

4.1 main categories of procedures 11

4.1.1 user administrator 11

4.1.4 classification of second-hand goods 12

4.1.4 orders for second-hand goods 12

4.1.4 orders for second-hand goods 13

4.1.4 details of second-hand goods 14

4.1.4 users and customers 15

4.3 screenshot of main modules of system function 16

4.3.1 landing page 16

4.3.1 login front end code: 16

4.3.2 registration page: 17

4.3.2 system function screenshot 17

4.3.4 display of some key source codes: 22

4.4 database table design 29

4.4.0 three data paradigms: 29

1, First paradigm 29

2, Second paradigm 29

3, The third paradigm 29

4.4.1 table ER figure 30

4.4.2 user table design 30

4.4.3 design of second-hand goods classification table 30

4.4.4 user order table design 31

4.4.5 detailed design of second-hand goods list 31

4.4.5 design of second-hand goods order form 32

4.4.6 database sql file 32

5, Reference contribution 36

Main functions:

Administrator: commodity classification management, commodity management, commodity order management, user management and other functions.
User role: view all goods, log in and register, view goods by category, publish goods, view the seller's home page, contact the seller, leave a message for goods, view orders, modify and view personal data.

Main technologies:

HTML+CSS+JavaScript+jsp+mysql+Spring+mybatis

System home page:

Login module:

Login code implementation:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>System login - Supermarket order management system</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath }/css/style.css" />
    <script type="text/javascript">
	/* if(top.location!=self.location){
	      top.location=self.location;
	 } */
    </script>
</head>
<body class="login_bg">
    <section class="loginBox">
        <header class="loginHeader">
            <h1>Second hand trading platform</h1>
        </header>
        <section class="loginCont">
	        <form class="loginForm" action="${pageContext.request.contextPath }/login.do"  name="actionForm" id="actionForm"  method="post" >
				<div class="info">${error }</div>
				<div class="inputbox">
                    <label for="user">user name:</label>
					<input type="text" class="input-text" id="userCode" name="userCode" placeholder="enter one user name" required/>
				</div>	
				<div class="inputbox">
                    <label for="mima">password:</label>
                    <input type="password" id="userPassword" name="userPassword" placeholder="Please input a password" required/>
                </div>	
				<div class="subBtn">
					
                    <input type="submit" value="Sign in"/>
                    <input type="reset" value="Reset"/>
                </div>	
			</form>
        </section>
    </section>
</body>
</html>

Product details:

Click purchase to create an order information:

Personal Center:

Administrator login:

Main code implementation:

/**
 * .
 *
 *
 *
 *
 */
 
package io.renren.modules.sys.controller;
 
 
import com.google.code.kaptcha.Constants;
import com.google.code.kaptcha.Producer;
import io.renren.common.utils.R;
import io.renren.modules.sys.shiro.ShiroUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.subject.Subject;
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.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
 
import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.awt.image.BufferedImage;
import java.io.IOException;
 
/**
 * Login related
 *
 * @author Mark s.com
 */
@Controller
public class SysLoginController {
	@Autowired
	private Producer producer;
	
	@RequestMapping("captcha.jpg")
	public void captcha(HttpServletResponse response)throws IOException {
        response.setHeader("Cache-Control", "no-store, no-cache");
        response.setContentType("image/jpeg");
 
        //Generate text verification code
        String text = producer.createText();
        //Generate picture verification code
        BufferedImage image = producer.createImage(text);
        //Save to shiro session
        ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
        
        ServletOutputStream out = response.getOutputStream();
        ImageIO.write(image, "jpg", out);
	}
	
	/**
	 * Sign in
	 */
	@ResponseBody
	@RequestMapping(value = "/sys/login", method = RequestMethod.POST)
	public R login(String username, String password, String captcha) {
		String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
		if(!captcha.equalsIgnoreCase(kaptcha)){
			return R.error("Incorrect verification code");
		}
		try{
			Subject subject = ShiroUtils.getSubject();
			UsernamePasswordToken token = new UsernamePasswordToken(username, password);//md5+Jiayan
			subject.login(token);
		}catch (UnknownAccountException e) {
			return R.error(e.getMessage());
		}catch (IncorrectCredentialsException e) {
			return R.error("Incorrect account or password");
		}catch (LockedAccountException e) {
			return R.error("Account locked,Please contact the administrator");
		}catch (AuthenticationException e) {
			return R.error("Account verification failed");
		}
	    
		return R.ok();
	}
	
	/**
	 * sign out
	 */
	@RequestMapping(value = "logout", method = RequestMethod.GET)
	public String logout() {
		ShiroUtils.logout();
		return "redirect:login.html";
	}
	
}

Main functions of administrator:

Classification management:

Commodity management:

Order management:

User management:

Main table design:

User table:

CREATE TABLE `NewTable` (
`user_id`  bigint(20) NOT NULL AUTO_INCREMENT ,
`username`  varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'user name' ,
`password`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'password' ,
`salt`  varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'salt' ,
`email`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'mailbox' ,
`mobile`  varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'cell-phone number' ,
`status`  tinyint(4) NULL DEFAULT NULL COMMENT 'Status 0: Disabled 1: normal' ,
`create_time`  datetime NULL DEFAULT NULL COMMENT 'Creation time' ,
PRIMARY KEY (`user_id`),
UNIQUE INDEX `username` (`username`) USING BTREE 
)

Order form:

CREATE TABLE `NewTable` (
`order_id`  bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Order table PK id' ,
`order_no`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'order number' ,
`user_id`  bigint(20) NOT NULL DEFAULT 0 COMMENT 'User primary key id' ,
`total_price`  int(11) NOT NULL DEFAULT 1 COMMENT 'Total order price' ,
`pay_status`  bigint(20) NOT NULL DEFAULT 0 COMMENT 'Payment status:0.Unpaid,1.Payment successful,-1:Payment failed' , ,
`pay_time`  datetime NULL DEFAULT NULL COMMENT 'Payment time' ,
`order_status`  bigint(20) NOT NULL DEFAULT 0 COMMENT 'Order status:0.To be paid 1.Paid 2.Distribution completed 3:Issue succeeded 4.Successful trade -1.Manual shutdown -2.Timeout shutdown -3.Merchant closure' ,
`extra_info`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'order body' ,
`user_name`  varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'Consignee Name ' ,
`user_phone`  varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'Consignee mobile number' ,
`user_address`  varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'Consignee receiving address' ,
PRIMARY KEY (`order_id`)
)

Commodity list:

CREATE TABLE `NewTable` (
`goods_id`  bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'Commodity table primary key id' ,
`goods_name`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'Trade name' ,
`goods_intro`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'Product introduction' ,
`goods_category_id`  bigint(20) NOT NULL DEFAULT 0 COMMENT 'Association classification id' ,
`goods_cover_img`  varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '/admin/dist/img/no-img.png' COMMENT 'Commodity master chart' ,
`goods_detail_content`  text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'Product details' ,
`original_price`  int(11) NOT NULL DEFAULT 1 COMMENT 'commodity price' ,
`selling_price`  int(11) NOT NULL DEFAULT 1 COMMENT 'Actual selling price of goods' ,
 
`tag`  varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT 'Commodity label' ,
`goods_sell_status`  tinyint(4) NOT NULL DEFAULT 0 COMMENT 'Product on shelf status 0-Off shelf 1-Put on the shelf' ,
`create_user`  int(11) NOT NULL DEFAULT 0 COMMENT 'Adder primary key id' ,
PRIMARY KEY (`goods_id`)
)

For details, you can chat privately. Thank you for your support and help!

Click to view more java boutique projects > > >

Keywords: Java JSP Spring Spring MVC SSM

Added by starrieyed on Sat, 22 Jan 2022 11:04:51 +0200