Java项目:电影票订票管理系统(java+swing+MySQL)

Posted qq_1334611189

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java项目:电影票订票管理系统(java+swing+MySQL)相关的知识,希望对你有一定的参考价值。

主要实现的功能有:

用户端:登录注册、查看电影信息、选择影院场次、选座购票、查看自己的影票、评价电影等功能。管理员:登录、电影管理、影院管理、场次管理、影票管理等功能.

 

 

 

访问控制层:


/**
 * 访问控制层
 */
@RestController()
public class AccountController 
    private final static String ACCOUNT_INFO_ERROR="用户名或密码错误";
    @Autowired
    private AccountServiceImpl accountService;
    @PostMapping("/login")
    public ResponseVO login(@RequestBody UserForm userForm, HttpSession session)
        UserVO user = accountService.login(userForm);
        if(user==null)
           return ResponseVO.buildFailure(ACCOUNT_INFO_ERROR);
        
        //注册session
        session.setAttribute(InterceptorConfiguration.SESSION_KEY,userForm);
        return ResponseVO.buildSuccess(user);
    
    @PostMapping("/register")
    public ResponseVO registerAccount(@RequestBody UserForm userForm)
        return accountService.registerAccount(userForm);
    

    @PostMapping("/logout")
    public String logOut(HttpSession session)
        session.removeAttribute(InterceptorConfiguration.SESSION_KEY);
        return "index";
    

    @GetMapping("/get/history")
    public ResponseVO getHistory(@RequestParam int userId)
        return accountService.getHistoryByUserId(userId);
    

    @PostMapping("insert/history")
    public ResponseVO insertHistory(@RequestBody historyItem history)return accountService.insertHistory(history); 

    @GetMapping("/get/user")
    public ResponseVO getUserById(@RequestParam int userId)return  accountService.getUserById(userId);

    @PostMapping("/update/user")
    public ResponseVO updateUser(@RequestBody User user)return  accountService.updateUser(user);

    @GetMapping("/get/all/user")
    public ResponseVO getAllUser()return  accountService.getAllUser();

    @PostMapping("/delete/user")
    public ResponseVO deleteUser(@RequestParam int userId)return accountService.deleteUser(userId);


售票控制层:



/**
 * 售票
 */
@RestController
@RequestMapping("/ticket")
public class TicketController 
    @Autowired
    TicketService ticketService;
    @Autowired
    AccountService accountService;
    @PostMapping("/vip/buy")
    public ResponseVO buyTicketByVIPCard(@RequestParam List<Integer> ticketId, @RequestParam int couponId)
        return ticketService.completeByVIPCard(ticketId,couponId);
    

    @PostMapping("/lockSeat")
    public ResponseVO lockSeat(@RequestBody TicketForm ticketForm)
        return ticketService.addTicket(ticketForm);
    
    @PostMapping("/buy")
    public ResponseVO buyTicket(@RequestParam List<Integer> ticketId,@RequestParam int couponId)
        return ticketService.completeTicket(ticketId,couponId);
    
    @GetMapping("/get/userId")
    public ResponseVO getTicketByUserId(@PathVariable int userId)
        return ticketService.getTicketByUser(userId);
    

    @GetMapping("/get/occupiedSeats")
    public ResponseVO getOccupiedSeats(@RequestParam int scheduleId)
        return ticketService.getBySchedule(scheduleId);
    

    @PostMapping("/cancel")
    public ResponseVO cancelTicket(@RequestParam List<Integer> ticketId)
        return ticketService.cancelTicket(ticketId);
    
    @PostMapping("insert/history")
    public ResponseVO insertHistory(@RequestBody historyItem history)return accountService.insertHistory(history); 




电影管理控制层:

/**
 * 电影管理
 */
@RestController
public class MovieController 

    @Autowired
    private MovieService movieService;
    @Autowired
    private MovieLikeService movieLikeService;

    @RequestMapping(value = "/movie/add", method = RequestMethod.POST)
    public ResponseVO addMovie(@RequestBody MovieForm addMovieForm)
        return movieService.addMovie(addMovieForm);
    

    @RequestMapping(value = "/movie/id/userId", method = RequestMethod.GET)
    public ResponseVO searchOneMovieByIdAndUserId(@PathVariable int id, @PathVariable int userId)
        return movieService.searchOneMovieByIdAndUserId(id, userId);
    

    @RequestMapping(value = "/movie/all", method = RequestMethod.GET)
    public ResponseVO searchAllMovie()
        //返回结果中包括已经下架的电影
        return movieService.searchAllMovie();
    

    @RequestMapping(value = "/movie/all/exclude/off", method = RequestMethod.GET)
    public ResponseVO searchOtherMoviesExcludeOff()
        //返回结果中不包括已经下架的电影
        return movieService.searchOtherMoviesExcludeOff();
    


    @RequestMapping(value = "/movie/movieId/like", method = RequestMethod.POST)
    public ResponseVO likeMovie(@PathVariable int movieId,@RequestParam int userId)
        return movieLikeService.likeMovie(userId,movieId);
    
    @RequestMapping(value = "/movie/movieId/unlike", method = RequestMethod.POST)
    public ResponseVO unlikeMovie(@PathVariable int movieId,@RequestParam int userId)
        return movieLikeService.unLikeMovie(userId,movieId);
    
    @RequestMapping(value = "/movie/movieId/like/count", method = RequestMethod.GET)
    public ResponseVO getMovieLikeCounts(@PathVariable int movieId)
        return movieLikeService.getCountOfLikes(movieId);
    

    @RequestMapping(value = "/movie/movieId/like/date", method = RequestMethod.GET)
    public ResponseVO getMovieLikeCountByDate(@PathVariable int movieId)
        return movieLikeService.getLikeNumsGroupByDate(movieId);
    

    @RequestMapping(value = "/movie/search",method = RequestMethod.GET)
    public ResponseVO getMovieByKeyword(@RequestParam String keyword)
        return movieService.getMovieByKeyword(keyword);
    

    @RequestMapping(value = "/movie/off/batch",method = RequestMethod.POST)
    public ResponseVO pullOfBatchOfMovie(@RequestBody MovieBatchOffForm movieBatchOffForm)
        return movieService.pullOfBatchOfMovie(movieBatchOffForm);
    

    @RequestMapping(value = "/movie/update",method = RequestMethod.POST)
    public ResponseVO updateMovie(@RequestBody MovieForm updateMovieForm)
        return movieService.updateMovie(updateMovieForm);
    





以上是关于Java项目:电影票订票管理系统(java+swing+MySQL)的主要内容,如果未能解决你的问题,请参考以下文章

基于 Springboot + Vue + Bootstrap 的电影票订票购票系统,可用于毕业设计课程设计练手学习

基于 Springboot + Vue + Bootstrap 的电影票订票购票系统,可用于毕业设计课程设计练手学习

基于SSM框架电影订票网站开发全程实录(附源码)

基于微信小程序的电影订票系统设计与实现(代码+数据库+论文)

计算机毕业设计源码分享-784双鱼林JSP_SSH2_EasyUI电影院电影票订票系统

基于安卓android studio的电影订票选座APP设计 前台后台