Implementation of train booking platform management system based on Java+SpringBoot+vue+element

Posted by Lytheum on Sat, 26 Feb 2022 04:39:36 +0100

🍅 Author profile: CSDN invited author ✌, Blog expert ✌, High quality creators in java field 💪

🍅 Pay attention to the official account [java Li Yang Yong] resume template, learning materials, interview questions library, etc. 💪

🍅 Get the source code at the end of the article 🍅

Preface introduction:

With the continuous popularization and development of network, the train reservation management system has developed rapidly with the support of network technology. First of all, we should start from the actual needs of users. By understanding the needs of users and developing targeted functions such as home page, personal center, user management, vehicle information management, ticket booking information management, train ticket order management, ticket refund order management and system management, the convenience of network brings this function to users to adjust the system. The design of the system makes users use more convenient, The main purpose of this system is to bring users fast, efficient and safe. Users can operate as long as they are at home. At the same time, with the development of e-commerce, online train ticket booking management system has also attracted the attention of the majority of users.

The development of the Internet has solved many problems that we can't solve, made our work more convenient and improved our work efficiency. At present, all walks of life are using network information management procedures, and different users are also exposed to information management, especially in the major e-commerce industries. Through the analysis and summary of the development of the current network environment, the development of train reservation management system can change the previous mode of train reservation management system and the state of the traditional offline train reservation management system. Due to the increasing number of users, the use of the traditional offline train reservation management system mode is far from meeting the needs of users, Moreover, more and more state-owned enterprises are also opening online train booking management system, so developing a train booking management system can solve the problem that state-owned enterprises are not conducive to the offline train booking management system, and the designed website can ensure the integrity and security of information, so as to improve work efficiency and ensure the safe and normal operation of the system.

Functional design:

The train booking management system mainly includes two functional modules, namely user function module and administrator function module.

(1) Administrator module: the core user in the system is the administrator. After logging in, the administrator manages the background system through the administrator function. The main functions include: home page, personal center, user management, model information management, train number information management, ticket purchase order management, ticket change order management, ticket refund order management, system management and other functions. The administrator use case diagram is shown in the figure.

(2) User: home page, personal center, ticket purchase order management, change order, refund order management and other functions, as shown in the figure.

(3) Front page: front page, train number information, train information, personal center, background management and other functions. The front page is shown in the figure.

Function screenshot:

Administrator login: login by filling in the user name, password and role entered during registration

User home page:

Train number information:

Train information:

Personal Center:

Signature change information:

Order information:

back-stage management:

User management:

Vehicle management:

Train number management:

Booking management:

Refund management:


Change management:

Train information:

Rotation chart, etc

Key source code:

/**
 * Login related
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;

	/**
	 * Sign in
	 */
	@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("Incorrect account or password");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * register
	 */
	@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("User already exists");
    	}
        userService.insert(user);
        return R.ok();
    }

	/**
	 * sign out
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("Exit successful");
	}
	
	/**
     * Password Reset 
     */
    @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("Account does not exist");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("Password reset to: 123456");
    }
	
	/**
     * list
     */
    @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);
    }

	/**
     * list
     */
    @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));
    }

    /**
     * information
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * Get the session user information of the user
     */
    @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);
    }

    /**
     * preservation
     */
    @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("User already exists");
    	}
        userService.insert(user);
        return R.ok();
    }

    /**
     * modify
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//Update all
        return R.ok();
    }

    /**
     * delete
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}
/**
 * Upload file mapping table
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	@Async
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("Uploaded file cannot be empty");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File upload = new File("D:/work/");
		if(!upload.exists()) {
			upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload+"/"+fileName);

		file.transferTo(dest);
		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);
	}
	
	/**
	 * Download File
	 */
	@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);
	}
	
}

Database design:

checixinxi table:

Serial number

Field name

Field type

size

Null allowed

Maximum length

remarks

1

id

Int

4

10

2

addtime

150

255

3

checimingcheng

150

255

4

huochemingcheng

DateTime

8

255

5

chepai

150

255

6

tupian

DateTime

8

255

7

qidianzhan

150

255

8

zhongdianzhan

DateTime

8

255

9

tujing

150

255

10

riqi

DateTime

8

255

11

chufashijian

150

255

12

shizhang

DateTime

8

255

13

zuoweileixing

150

255

14

jiage

DateTime

8

255

15

piaoshu

150

255

chexingxinxi table:

Serial number

Field name

Field type

size

Null allowed

Maximum length

remarks

1

id

Int

4

10

2

addtime

150

255

3

huochebianhao

150

255

4

huochemingcheng

DateTime

8

255

5

shisu

150

255

6

zuoweishu

DateTime

8

255

7

chepai

150

255

gaiqiandingdan table:

Serial number

Field name

Field type

size

Null allowed

Maximum length

remarks

1

id

Int

4

10

2

addtime

150

255

3

dingdanbianhao

150

255

4

checimingcheng

150

255

5

chepai

DateTime

8

255

6

qidianzhan

shangpinleixing

DateTime

8

255

7

zhongdianzhan

255

8

zongjiage

DateTime

255

9

gaiqianriqi

DateTime

255

10

yonghuming

DateTime

255

11

xingming

DateTime

255

12

shouji

DateTime

255

goupiaodingdan table:

Serial number

Field name

Field type

size

Null allowed

Maximum length

remarks

1

id

Int

4

10

2

addtime

150

255

3

dingdanbianhao

150

255

4

checimingcheng

150

255

5

chepai

DateTime

8

255

6

qidianzhan

DateTime

255

7

zhongdianzhan

255

8

chufashijian

shangpinleixing

DateTime

8

255

9

zuoweileixing

shangpinleixing

DateTime

8

255

10

jiage

shangpinleixing

DateTime

8

255

11

piaoshu

shangpinleixing

DateTime

8

255

12

zongjiage

shangpinleixing

DateTime

8

255

13

zongjiage

shangpinleixing

DateTime

8

255

14

goumairiqi

shangpinleixing

DateTime

8

255

15

yonghuming

shangpinleixing

DateTime

8

255

16

xingming

shangpinleixing

DateTime

8

255

17

shouji

shangpinleixing

DateTime

8

255

18

shenfenzheng

shangpinleixing

DateTime

8

255

Paper report:

Abstract

1 Introduction

1.1 research background

1.2 research status

1.3 research content

2. Key technologies of the system

2.1 Spring Boot framework

2.2 JAVA technology

2.3 MYSQL database

2.4 B/S structure

3 system analysis

3.1 feasibility analysis

3.1.1 technical feasibility

3.1.2 economic feasibility

3.1.3 operational feasibility

3.2 system performance analysis

3.3 system function analysis

3.4 system process analysis

3.4.1 login process

3.4.2 registration process

3.4.3 adding information process

3.4.4 delete information process

4 system design

4.1 system outline design

4.2 system structure design

4.3 system sequence diagram design

4.3.1 sequence diagram of login module

4.3.2 sequence diagram of adding information module

4.4 database design

4.4.1 database E-R diagram design

4.4.2 database table design

Chapter 5 detailed system design

5.1 front page function module

5.2 administrator function module

5.3 user function module

6 system test

6.1 test definition

6.2 test purpose

6.3 test scheme

(1) Module test

(2) Integration test:

(3) Acceptance test:

6.4 system analysis

7 conclusion

reference

thank-you speech

Source code acquisition:

Everyone likes, collects, pays attention to, comments and views 👇🏻👇🏻👇🏻 WeChat official account for contact information 👇🏻👇🏻👇🏻

Punch in article update 208 / 365 days

Recommended subscription of wonderful column: in the column below 👇🏻👇🏻👇🏻👇🏻

Excellent practical case of Java project "100 sets"

Web front end final homework web page practice "100 sets"

Topics: Java Spring Boot Vue.js