jacksenma před 7 roky
rodič
revize
1ea2122bad
32 změnil soubory, kde provedl 680 přidání a 66 odebrání
  1. 2 3
      src/main/java/com/example/cinema/blImpl/management/hall/HallServiceForBl.java
  2. 27 2
      src/main/java/com/example/cinema/blImpl/management/hall/HallServiceImpl.java
  3. 38 13
      src/main/java/com/example/cinema/blImpl/management/movie/MovieServiceImpl.java
  4. 2 1
      src/main/java/com/example/cinema/blImpl/management/schedule/MovieServiceForBl.java
  5. 1 1
      src/main/java/com/example/cinema/blImpl/management/schedule/ScheduleServiceForBl.java
  6. 36 7
      src/main/java/com/example/cinema/blImpl/management/schedule/ScheduleServiceImpl.java
  7. 3 1
      src/main/java/com/example/cinema/blImpl/sales/TicketServiceImpl.java
  8. 23 1
      src/main/java/com/example/cinema/blImpl/statistics/MovieLikeServiceImpl.java
  9. 44 4
      src/main/java/com/example/cinema/blImpl/statistics/StatisticsServiceImpl.java
  10. 13 1
      src/main/java/com/example/cinema/blImpl/user/AccountServiceImpl.java
  11. 3 3
      src/main/java/com/example/cinema/data/management/HallMapper.java
  12. 6 5
      src/main/java/com/example/cinema/data/management/MovieMapper.java
  13. 1 1
      src/main/java/com/example/cinema/data/management/ScheduleMapper.java
  14. 5 6
      src/main/java/com/example/cinema/data/statistics/StatisticsMapper.java
  15. 2 2
      src/main/java/com/example/cinema/data/user/AccountMapper.java
  16. 1 1
      src/main/java/com/example/cinema/po/AudiencePrice.java
  17. 44 0
      src/main/java/com/example/cinema/po/Hall.java
  18. 192 0
      src/main/java/com/example/cinema/po/Movie.java
  19. 38 0
      src/main/java/com/example/cinema/po/MovieScheduleTime.java
  20. 38 0
      src/main/java/com/example/cinema/po/MovieTotalBoxOffice.java
  21. 1 1
      src/main/java/com/example/cinema/po/ScheduleItem.java
  22. 35 0
      src/main/java/com/example/cinema/vo/DateLikeVO.java
  23. 106 0
      src/main/java/com/example/cinema/vo/ScheduleItemVO.java
  24. 5 3
      src/main/java/com/example/cinema/vo/ScheduleVO.java
  25. 3 1
      src/main/java/com/example/cinema/vo/ScheduleWithSeatVO.java
  26. 2 0
      src/main/java/com/example/cinema/vo/TicketWithScheduleVO.java
  27. 2 2
      src/main/resources/application.yml
  28. 1 1
      src/main/resources/dataImpl/management/HallMapper.xml
  29. 1 1
      src/main/resources/dataImpl/management/MovieMapper.xml
  30. 1 1
      src/main/resources/dataImpl/management/ScheduleMapper.xml
  31. 3 3
      src/main/resources/dataImpl/statistics/StatisticsMapper.xml
  32. 1 1
      src/main/resources/dataImpl/user/AccountMapper.xml

+ 2 - 3
src/main/java/com/example/cinema/blImpl/management/hall/HallServiceForBl.java

@@ -1,7 +1,6 @@
 package com.example.cinema.blImpl.management.hall;
 
-import com.example.cinema.vo.HallVO;
-
+import com.example.cinema.po.Hall;
 /**
  * @author fjj
  * @date 2019/4/28 12:27 AM
@@ -12,5 +11,5 @@ public interface HallServiceForBl {
      * @param id
      * @return
      */
-    HallVO getHallById(int id);
+    Hall getHallById(int id);
 }

+ 27 - 2
src/main/java/com/example/cinema/blImpl/management/hall/HallServiceImpl.java

@@ -2,11 +2,15 @@ package com.example.cinema.blImpl.management.hall;
 
 import com.example.cinema.bl.management.HallService;
 import com.example.cinema.data.management.HallMapper;
+import com.example.cinema.po.Hall;
 import com.example.cinema.vo.HallVO;
 import com.example.cinema.vo.ResponseVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * @author fjj
  * @date 2019/4/12 2:01 PM
@@ -19,7 +23,7 @@ public class HallServiceImpl implements HallService, HallServiceForBl {
     @Override
     public ResponseVO searchAllHall() {
         try {
-            return ResponseVO.buildSuccess(hallMapper.selectAllHall());
+            return ResponseVO.buildSuccess(hallList2HallVOList(hallMapper.selectAllHall()));
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -27,7 +31,7 @@ public class HallServiceImpl implements HallService, HallServiceForBl {
     }
 
     @Override
-    public HallVO getHallById(int id) {
+    public Hall getHallById(int id) {
         try {
             return hallMapper.selectHallById(id);
         } catch (Exception e) {
@@ -36,4 +40,25 @@ public class HallServiceImpl implements HallService, HallServiceForBl {
         }
 
     }
+
+    private HallVO hall2hallVO(Hall hall){
+        if(hall != null){
+            HallVO hallVO = new HallVO();
+            hallVO.setId(hall.getId());
+            hallVO.setName(hall.getName());
+            hallVO.setRow(hall.getRow());
+            hallVO.setColumn(hall.getColumn());
+
+            return hallVO;
+        }
+        return null;
+    }
+
+    private List<HallVO> hallList2HallVOList(List<Hall> hallList){
+        List<HallVO> hallVOList = new ArrayList<>();
+        for(Hall hall : hallList){
+            hallVOList.add(hall2hallVO(hall));
+        }
+        return hallVOList;
+    }
 }

+ 38 - 13
src/main/java/com/example/cinema/blImpl/management/movie/MovieServiceImpl.java

@@ -4,10 +4,13 @@ import com.example.cinema.bl.management.MovieService;
 import com.example.cinema.blImpl.management.schedule.MovieServiceForBl;
 import com.example.cinema.blImpl.management.schedule.ScheduleServiceForBl;
 import com.example.cinema.data.management.MovieMapper;
+import com.example.cinema.po.Movie;
+import com.example.cinema.po.ScheduleItem;
 import com.example.cinema.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
@@ -39,7 +42,7 @@ public class MovieServiceImpl implements MovieService, MovieServiceForBl {
     @Override
     public ResponseVO searchOneMovieByIdAndUserId(int id, int userId) {
         try {
-            return ResponseVO.buildSuccess(movieMapper.selectMovieByIdAndUserId(id, userId));
+            return ResponseVO.buildSuccess(movie2MovieVO(movieMapper.selectMovieByIdAndUserId(id, userId)));
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -50,7 +53,7 @@ public class MovieServiceImpl implements MovieService, MovieServiceForBl {
     @Override
     public ResponseVO searchAllMovie() {
         try {
-            return ResponseVO.buildSuccess(movieMapper.selectAllMovie());
+            return ResponseVO.buildSuccess(movieList2MovieVOList(movieMapper.selectAllMovie()));
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -60,25 +63,19 @@ public class MovieServiceImpl implements MovieService, MovieServiceForBl {
     @Override
     public ResponseVO searchOtherMoviesExcludeOff() {
         try {
-            return ResponseVO.buildSuccess(movieMapper.selectOtherMoviesExcludeOff());
+            return ResponseVO.buildSuccess(movieList2MovieVOList(movieMapper.selectOtherMoviesExcludeOff()));
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
         }
     }
 
-
-
-
-
-
-
     @Override
     public ResponseVO getMovieByKeyword(String keyword) {
         if (keyword==null||keyword.equals("")){
-            return ResponseVO.buildSuccess(movieMapper.selectAllMovie());
+            return ResponseVO.buildSuccess(movieList2MovieVOList(movieMapper.selectAllMovie()));
         }
-        return ResponseVO.buildSuccess(movieMapper.selectMovieByKeyword(keyword));
+        return ResponseVO.buildSuccess(movieList2MovieVOList(movieMapper.selectMovieByKeyword(keyword)));
     }
 
 
@@ -116,7 +113,7 @@ public class MovieServiceImpl implements MovieService, MovieServiceForBl {
     }
 
     @Override
-    public MovieVO getMovieById(int id) {
+    public Movie getMovieById(int id) {
         try {
             return movieMapper.selectMovieById(id);
         }catch (Exception e){
@@ -145,7 +142,35 @@ public class MovieServiceImpl implements MovieService, MovieServiceForBl {
     }
 
 
+    private MovieVO movie2MovieVO(Movie movie){
+        if(movie != null){
+            MovieVO movieVO = new MovieVO();
+            movieVO.setId(movie.getId());
+            movieVO.setName(movie.getName());
+            movieVO.setPosterUrl(movie.getPosterUrl());
+            movieVO.setDirector(movie.getDirector());
+            movieVO.setScreenWriter(movie.getScreenWriter());
+            movieVO.setStarring(movie.getStarring());
+            movieVO.setType(movie.getType());
+            movieVO.setCountry(movie.getCountry());
+            movieVO.setLanguage(movie.getLanguage());
+            movieVO.setStartDate(movie.getStartDate());
+            movieVO.setLength(movie.getLength());
+            movieVO.setDescription(movie.getDescription());
+            movieVO.setStatus(movie.getStatus());
+            movieVO.setIslike(movie.getIslike());
+            movieVO.setLikeCount(movie.getLikeCount());
+            return movieVO;
+        }
+        return null;
+    }
 
-
+    private List<MovieVO> movieList2MovieVOList(List<Movie> movieList){
+        List<MovieVO> movieVOList = new ArrayList<>();
+        for(Movie movie : movieList){
+            movieVOList.add(movie2MovieVO(movie));
+        }
+        return movieVOList;
+    }
 
 }

+ 2 - 1
src/main/java/com/example/cinema/blImpl/management/schedule/MovieServiceForBl.java

@@ -1,5 +1,6 @@
 package com.example.cinema.blImpl.management.schedule;
 
+import com.example.cinema.po.Movie;
 import com.example.cinema.vo.MovieVO;
 
 /**
@@ -12,5 +13,5 @@ public interface MovieServiceForBl {
      * @param id
      * @return
      */
-    MovieVO getMovieById(int id);
+    Movie getMovieById(int id);
 }

+ 1 - 1
src/main/java/com/example/cinema/blImpl/management/schedule/ScheduleServiceForBl.java

@@ -1,6 +1,6 @@
 package com.example.cinema.blImpl.management.schedule;
 
-import com.example.cinema.vo.ScheduleItem;
+import com.example.cinema.po.ScheduleItem;
 
 import java.util.List;
 

+ 36 - 7
src/main/java/com/example/cinema/blImpl/management/schedule/ScheduleServiceImpl.java

@@ -1,8 +1,11 @@
 package com.example.cinema.blImpl.management.schedule;
+import java.util.Date;
 
 import com.example.cinema.bl.management.ScheduleService;
 import com.example.cinema.blImpl.management.hall.HallServiceForBl;
 import com.example.cinema.data.management.ScheduleMapper;
+import com.example.cinema.po.Movie;
+import com.example.cinema.po.ScheduleItem;
 import com.example.cinema.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -75,7 +78,7 @@ public class ScheduleServiceImpl implements ScheduleService, ScheduleServiceForB
     @Override
     public ResponseVO getScheduleById(int id) {
         try {
-            return ResponseVO.buildSuccess(scheduleMapper.selectScheduleById(id));
+            return ResponseVO.buildSuccess(scheduleItem2ScheduleItemVO(scheduleMapper.selectScheduleById(id)));
         }catch (Exception e){
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -243,18 +246,18 @@ public class ScheduleServiceImpl implements ScheduleService, ScheduleServiceForB
             }
 
             // 检查电影是否存在
-            MovieVO movieVO = movieServiceForBl.getMovieById(scheduleForm.getMovieId());
-            if(movieVO == null){
+            Movie movie = movieServiceForBl.getMovieById(scheduleForm.getMovieId());
+            if(movie == null){
                 return ResponseVO.buildFailure(MOVIE_NOT_EXIST_ERROR_MESSAGE);
             }
 
             // 检查电影的上映时间是否和排片时间匹配
-            if(scheduleForm.getStartTime().before(movieVO.getStartDate())){
+            if(scheduleForm.getStartTime().before(movie.getStartDate())){
                 return ResponseVO.buildFailure(BEFORE_START_DATE_ERROR_MESSAGE);
             }
 
             // 校验排片时间段合法性
-            int minutes = movieVO.getLength();
+            int minutes = movie.getLength();
             Calendar calendarStartTime = Calendar.getInstance();
             calendarStartTime.setTime(scheduleForm.getStartTime());
             calendarStartTime.add(Calendar.MINUTE, minutes);
@@ -297,8 +300,9 @@ public class ScheduleServiceImpl implements ScheduleService, ScheduleServiceForB
             Date date = getNumDayAfterDate(startDate, i);
             ScheduleVO scheduleVO = new ScheduleVO();
             scheduleVO.setDate(date);
-            List<ScheduleItem> scheduleItems = new ArrayList<>();
-            for(ScheduleItem scheduleItem : scheduleItemList){
+            List<ScheduleItemVO> scheduleItems = new ArrayList<>();
+            List<ScheduleItemVO> scheduleItemVOList = scheduleItemList2ScheduleItemVOList(scheduleItemList);
+            for(ScheduleItemVO scheduleItem : scheduleItemVOList){
                 Date startTime = simpleDateFormat.parse(simpleDateFormat.format(scheduleItem.getStartTime()));
                 if(date.equals(startTime)){
                     scheduleItems.add(scheduleItem);
@@ -309,4 +313,29 @@ public class ScheduleServiceImpl implements ScheduleService, ScheduleServiceForB
         }
         return scheduleVOList;
     }
+
+    private ScheduleItemVO scheduleItem2ScheduleItemVO(ScheduleItem scheduleItem){
+        if(scheduleItem != null){
+            ScheduleItemVO scheduleItemVO = new ScheduleItemVO();
+            scheduleItemVO.setId(scheduleItem.getId());
+            scheduleItemVO.setHallId(scheduleItem.getHallId());
+            scheduleItemVO.setHallName(scheduleItem.getHallName());
+            scheduleItemVO.setMovieId(scheduleItem.getMovieId());
+            scheduleItemVO.setMovieName(scheduleItem.getMovieName());
+            scheduleItemVO.setStartTime(scheduleItem.getStartTime());
+            scheduleItemVO.setEndTime(scheduleItem.getEndTime());
+            scheduleItemVO.setFare(scheduleItem.getFare());
+
+            return scheduleItemVO;
+        }
+        return null;
+    }
+
+    private List<ScheduleItemVO> scheduleItemList2ScheduleItemVOList(List<ScheduleItem> scheduleItemList){
+        List<ScheduleItemVO> scheduleItemVOList = new ArrayList<>();
+        for(ScheduleItem scheduleItem : scheduleItemList){
+            scheduleItemVOList.add(scheduleItem2ScheduleItemVO(scheduleItem));
+        }
+        return scheduleItemVOList;
+    }
 }

+ 3 - 1
src/main/java/com/example/cinema/blImpl/sales/TicketServiceImpl.java

@@ -4,6 +4,8 @@ import com.example.cinema.bl.sales.TicketService;
 import com.example.cinema.blImpl.management.hall.HallServiceForBl;
 import com.example.cinema.blImpl.management.schedule.ScheduleServiceForBl;
 import com.example.cinema.data.sales.TicketMapper;
+import com.example.cinema.po.Hall;
+import com.example.cinema.po.ScheduleItem;
 import com.example.cinema.po.Ticket;
 import com.example.cinema.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -42,7 +44,7 @@ public class TicketServiceImpl implements TicketService {
         try {
             List<Ticket> tickets = ticketMapper.selectTicketsBySchedule(scheduleId);
             ScheduleItem schedule=scheduleService.getScheduleItemById(tickets.get(0).getScheduleId());
-            HallVO hall=hallService.getHallById(schedule.getHallId());
+            Hall hall=hallService.getHallById(schedule.getHallId());
             int[][] seats=new int[hall.getRow()][hall.getColumn()];
             tickets.stream().forEach(ticket -> {
                 seats[ticket.getRowIndex()][ticket.getColumnIndex()]=1;

+ 23 - 1
src/main/java/com/example/cinema/blImpl/statistics/MovieLikeServiceImpl.java

@@ -1,8 +1,12 @@
 package com.example.cinema.blImpl.statistics;
+import java.util.ArrayList;
+import java.util.List;
 
 import com.example.cinema.bl.statistics.MovieLikeService;
 import com.example.cinema.blImpl.management.schedule.MovieServiceForBl;
 import com.example.cinema.data.statistics.MovieLikeMapper;
+import com.example.cinema.po.DateLike;
+import com.example.cinema.vo.DateLikeVO;
 import com.example.cinema.vo.ResponseVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -68,7 +72,7 @@ public class MovieLikeServiceImpl implements MovieLikeService {
     @Override
     public ResponseVO getLikeNumsGroupByDate(int movieId) {
         try {
-            return ResponseVO.buildSuccess(movieLikeMapper.getDateLikeNum(movieId));
+            return ResponseVO.buildSuccess(dateLikeList2DateLikeVOList(movieLikeMapper.getDateLikeNum(movieId)));
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -78,4 +82,22 @@ public class MovieLikeServiceImpl implements MovieLikeService {
     private boolean userLikeTheMovie(int userId, int movieId) {
         return movieLikeMapper.selectLikeMovie(movieId, userId) == 0 ? false : true;
     }
+
+    private DateLikeVO dateLike2DateLikeVO(DateLike dateLike){
+        if(dateLike != null){
+            DateLikeVO dateLikeVO = new DateLikeVO();
+            dateLikeVO.setLikeNum(dateLike.getLikeNum());
+            dateLikeVO.setLikeTime(dateLike.getLikeTime());
+            return dateLikeVO;
+        }
+        return null;
+    }
+
+    private List<DateLikeVO> dateLikeList2DateLikeVOList(List<DateLike> dateLikeList){
+        List<DateLikeVO> dateLikeVOList = new ArrayList<>();
+        for(DateLike dateLike : dateLikeList){
+            dateLikeVOList.add(dateLike2DateLikeVO(dateLike));
+        }
+        return dateLikeVOList;
+    }
 }

+ 44 - 4
src/main/java/com/example/cinema/blImpl/statistics/StatisticsServiceImpl.java

@@ -2,9 +2,12 @@ package com.example.cinema.blImpl.statistics;
 
 import com.example.cinema.bl.statistics.StatisticsService;
 import com.example.cinema.data.statistics.StatisticsMapper;
-import com.example.cinema.vo.AudiencePrice;
+import com.example.cinema.po.AudiencePrice;
+import com.example.cinema.po.MovieScheduleTime;
+import com.example.cinema.po.MovieTotalBoxOffice;
 import com.example.cinema.vo.AudiencePriceVO;
 import com.example.cinema.vo.MovieScheduleTimeVO;
+import com.example.cinema.vo.MovieTotalBoxOfficeVO;
 import com.example.cinema.vo.ResponseVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -34,8 +37,7 @@ public class StatisticsServiceImpl implements StatisticsService {
             requireDate = simpleDateFormat.parse(simpleDateFormat.format(requireDate));
 
             Date nextDate = getNumDayAfterDate(requireDate, 1);
-            List<MovieScheduleTimeVO> movieScheduleTimeVOList = statisticsMapper.selectMovieScheduleTimes(requireDate, nextDate);
-            return ResponseVO.buildSuccess(movieScheduleTimeVOList);
+            return ResponseVO.buildSuccess(movieScheduleTimeList2MovieScheduleTimeVOList(statisticsMapper.selectMovieScheduleTimes(requireDate, nextDate)));
 
         }catch (Exception e){
             e.printStackTrace();
@@ -46,7 +48,7 @@ public class StatisticsServiceImpl implements StatisticsService {
     @Override
     public ResponseVO getTotalBoxOffice() {
         try {
-            return ResponseVO.buildSuccess(statisticsMapper.selectMovieTotalBoxOffice());
+            return ResponseVO.buildSuccess(movieTotalBoxOfficeList2MovieTotalBoxOfficeVOList(statisticsMapper.selectMovieTotalBoxOffice()));
         }catch (Exception e){
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -101,4 +103,42 @@ public class StatisticsServiceImpl implements StatisticsService {
         calendarTime.add(Calendar.DAY_OF_YEAR, num);
         return calendarTime.getTime();
     }
+
+    private MovieScheduleTimeVO movieScheduleTime2MovieScheduleTimeVO(MovieScheduleTime movieScheduleTime){
+        if(movieScheduleTime != null){
+            MovieScheduleTimeVO movieScheduleTimeVO = new MovieScheduleTimeVO();
+            movieScheduleTimeVO.setMovieId(movieScheduleTime.getMovieId());
+            movieScheduleTimeVO.setTime(movieScheduleTime.getTime());
+            movieScheduleTimeVO.setName(movieScheduleTime.getName());
+            return movieScheduleTimeVO;
+        }
+        return null;
+    }
+
+    private List<MovieScheduleTimeVO> movieScheduleTimeList2MovieScheduleTimeVOList(List<MovieScheduleTime> movieScheduleTimeList){
+        List<MovieScheduleTimeVO> movieScheduleTimeVOList = new ArrayList<>();
+        for(MovieScheduleTime movieScheduleTime : movieScheduleTimeList){
+            movieScheduleTimeVOList.add(movieScheduleTime2MovieScheduleTimeVO(movieScheduleTime));
+        }
+        return movieScheduleTimeVOList;
+    }
+
+    private MovieTotalBoxOfficeVO movieTotalBoxOffice2MovieTotalBoxOfficeVO(MovieTotalBoxOffice movieTotalBoxOffice){
+        if(movieTotalBoxOffice != null){
+            MovieTotalBoxOfficeVO movieTotalBoxOfficeVO = new MovieTotalBoxOfficeVO();
+            movieTotalBoxOfficeVO.setMovieId(movieTotalBoxOffice.getMovieId());
+            movieTotalBoxOfficeVO.setBoxOffice(movieTotalBoxOffice.getBoxOffice());
+            movieTotalBoxOfficeVO.setName(movieTotalBoxOffice.getName());
+            return movieTotalBoxOfficeVO;
+        }
+        return null;
+    }
+
+    private List<MovieTotalBoxOfficeVO> movieTotalBoxOfficeList2MovieTotalBoxOfficeVOList(List<MovieTotalBoxOffice> movieTotalBoxOfficeList){
+        List<MovieTotalBoxOfficeVO> movieTotalBoxOfficeVOList = new ArrayList<>();
+        for(MovieTotalBoxOffice movieTotalBoxOffice : movieTotalBoxOfficeList){
+            movieTotalBoxOfficeVOList.add(movieTotalBoxOffice2MovieTotalBoxOfficeVO(movieTotalBoxOffice));
+        }
+        return movieTotalBoxOfficeVOList;
+    }
 }

+ 13 - 1
src/main/java/com/example/cinema/blImpl/user/AccountServiceImpl.java

@@ -2,6 +2,7 @@ package com.example.cinema.blImpl.user;
 
 import com.example.cinema.bl.user.AccountService;
 import com.example.cinema.data.user.AccountMapper;
+import com.example.cinema.po.User;
 import com.example.cinema.vo.UserForm;
 import com.example.cinema.vo.ResponseVO;
 import com.example.cinema.vo.UserVO;
@@ -30,10 +31,21 @@ public class AccountServiceImpl implements AccountService {
 
     @Override
     public UserVO login(UserForm userForm) {
-        UserVO user = accountMapper.getAccountByName(userForm.getUsername());
+        UserVO user = user2UserVO(accountMapper.getAccountByName(userForm.getUsername()));
         if (null == user || !user.getPassword().equals(userForm.getPassword())) {
             return null;
         }
         return user;
     }
+
+    private UserVO user2UserVO(User user){
+        if(user != null){
+            UserVO userVO = new UserVO();
+            userVO.setId(user.getId());
+            userVO.setUsername(user.getUsername());
+            userVO.setPassword(user.getPassword());
+            return userVO;
+        }
+        return null;
+    }
 }

+ 3 - 3
src/main/java/com/example/cinema/data/management/HallMapper.java

@@ -1,6 +1,6 @@
 package com.example.cinema.data.management;
 
-import com.example.cinema.vo.HallVO;
+import com.example.cinema.po.Hall;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -16,11 +16,11 @@ public interface HallMapper {
      * 查询所有影厅信息
      * @return
      */
-    List<HallVO> selectAllHall();
+    List<Hall> selectAllHall();
 
     /**
      * 根据id查询影厅
      * @return
      */
-    HallVO selectHallById(@Param("hallId") int hallId);
+    Hall selectHallById(@Param("hallId") int hallId);
 }

+ 6 - 5
src/main/java/com/example/cinema/data/management/MovieMapper.java

@@ -1,5 +1,6 @@
 package com.example.cinema.data.management;
 
+import com.example.cinema.po.Movie;
 import com.example.cinema.vo.MovieForm;
 import com.example.cinema.vo.MovieVO;
 import org.apache.ibatis.annotations.Mapper;
@@ -25,7 +26,7 @@ public interface MovieMapper {
      * @param id
      * @return
      */
-    MovieVO selectMovieById(@Param("id") int id);
+    Movie selectMovieById(@Param("id") int id);
 
     /**
      * 根据id和userId查找电影
@@ -33,26 +34,26 @@ public interface MovieMapper {
      * @param userId
      * @return
      */
-    MovieVO selectMovieByIdAndUserId(@Param("id") int id, @Param("userId") int userId);
+    Movie selectMovieByIdAndUserId(@Param("id") int id, @Param("userId") int userId);
 
     /**
      * 展示所有电影
      * @return
      */
-    List<MovieVO> selectAllMovie();
+    List<Movie> selectAllMovie();
 
     /**
      * 展示所有电影(不包括已经下架的)
      * @return
      */
-    List<MovieVO> selectOtherMoviesExcludeOff();
+    List<Movie> selectOtherMoviesExcludeOff();
 
     /**
      * 根据关键字搜索电影
      * @param keyword
      * @return
      */
-    List<MovieVO> selectMovieByKeyword(@Param("keyword") String keyword);
+    List<Movie> selectMovieByKeyword(@Param("keyword") String keyword);
 
     /**
      * 批量更新电影状态

+ 1 - 1
src/main/java/com/example/cinema/data/management/ScheduleMapper.java

@@ -2,7 +2,7 @@ package com.example.cinema.data.management;
 
 
 import com.example.cinema.vo.ScheduleForm;
-import com.example.cinema.vo.ScheduleItem;
+import com.example.cinema.po.ScheduleItem;
 import com.example.cinema.vo.ScheduleViewForm;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;

+ 5 - 6
src/main/java/com/example/cinema/data/statistics/StatisticsMapper.java

@@ -1,9 +1,8 @@
 package com.example.cinema.data.statistics;
 
-import com.example.cinema.vo.AudiencePrice;
-import com.example.cinema.vo.MovieScheduleTimeVO;
-import com.example.cinema.vo.MovieTotalBoxOfficeVO;
-import com.example.cinema.vo.ResponseVO;
+import com.example.cinema.po.AudiencePrice;
+import com.example.cinema.po.MovieScheduleTime;
+import com.example.cinema.po.MovieTotalBoxOffice;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -21,13 +20,13 @@ public interface StatisticsMapper {
      * @param date
      * @return
      */
-    List<MovieScheduleTimeVO> selectMovieScheduleTimes(@Param("date") Date date, @Param("nextDate") Date nextDate);
+    List<MovieScheduleTime> selectMovieScheduleTimes(@Param("date") Date date, @Param("nextDate") Date nextDate);
 
     /**
      * 查询所有电影的总票房(包括已经下架的,降序排列)
      * @return
      */
-    List<MovieTotalBoxOfficeVO> selectMovieTotalBoxOffice();
+    List<MovieTotalBoxOffice> selectMovieTotalBoxOffice();
 
     /**
      * 查询某天每个客户的购票金额

+ 2 - 2
src/main/java/com/example/cinema/data/user/AccountMapper.java

@@ -1,6 +1,6 @@
 package com.example.cinema.data.user;
 
-import com.example.cinema.vo.UserVO;
+import com.example.cinema.po.User;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -24,5 +24,5 @@ public interface AccountMapper {
      * @param username
      * @return
      */
-    public UserVO getAccountByName(@Param("username") String username);
+    public User getAccountByName(@Param("username") String username);
 }

+ 1 - 1
src/main/java/com/example/cinema/vo/AudiencePrice.java → src/main/java/com/example/cinema/po/AudiencePrice.java

@@ -1,4 +1,4 @@
-package com.example.cinema.vo;
+package com.example.cinema.po;
 
 /**
  * @author fjj

+ 44 - 0
src/main/java/com/example/cinema/po/Hall.java

@@ -0,0 +1,44 @@
+package com.example.cinema.po;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 5:09 PM
+ */
+public class Hall {
+    private Integer id;
+    private String name;
+    private Integer row;
+    private Integer column;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Integer getRow() {
+        return row;
+    }
+
+    public void setRow(Integer row) {
+        this.row = row;
+    }
+
+    public Integer getColumn() {
+        return column;
+    }
+
+    public void setColumn(Integer column) {
+        this.column = column;
+    }
+}

+ 192 - 0
src/main/java/com/example/cinema/po/Movie.java

@@ -0,0 +1,192 @@
+package com.example.cinema.po;
+
+import java.util.Date;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 5:12 PM
+ */
+public class Movie {
+    /**
+     * 电影id
+     */
+    private Integer id;
+    /**
+     * 电影名称
+     */
+    private String name;
+    /**
+     * 海报url
+     */
+    private String posterUrl;
+    /**
+     * 导演
+     */
+    private String director;
+    /**
+     * 编剧
+     */
+    private String screenWriter;
+    /**
+     * 主演
+     */
+    private String starring;
+    /**
+     * 电影类型
+     */
+    private String type;
+    /**
+     * 制片国家/地区
+     */
+    private String country;
+    /**
+     * 语言
+     */
+    private String language;
+    /**
+     * 上映时间
+     */
+    private Date startDate;
+    /**
+     * 片长
+     */
+    private Integer length;
+    /**
+     * 描述
+     * @return
+     */
+    private String description;
+    /**
+     * 电影状态,0:上架状态,1:下架状态
+     */
+    private Integer status;
+    /**
+     * 是否想看,0:未标记想看,1:已标记想看
+     */
+    private Integer islike;
+    /**
+     * 想看人数
+     * @return
+     */
+    private Integer likeCount;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getPosterUrl() {
+        return posterUrl;
+    }
+
+    public void setPosterUrl(String posterUrl) {
+        this.posterUrl = posterUrl;
+    }
+
+    public String getDirector() {
+        return director;
+    }
+
+    public void setDirector(String director) {
+        this.director = director;
+    }
+
+    public String getScreenWriter() {
+        return screenWriter;
+    }
+
+    public void setScreenWriter(String screenWriter) {
+        this.screenWriter = screenWriter;
+    }
+
+    public String getStarring() {
+        return starring;
+    }
+
+    public void setStarring(String starring) {
+        this.starring = starring;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    public String getCountry() {
+        return country;
+    }
+
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    public String getLanguage() {
+        return language;
+    }
+
+    public void setLanguage(String language) {
+        this.language = language;
+    }
+
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    public Integer getLength() {
+        return length;
+    }
+
+    public void setLength(Integer length) {
+        this.length = length;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getIslike() {
+        return islike;
+    }
+
+    public void setIslike(Integer islike) {
+        this.islike = islike;
+    }
+
+    public Integer getLikeCount() {
+        return likeCount;
+    }
+
+    public void setLikeCount(Integer likeCount) {
+        this.likeCount = likeCount;
+    }
+}

+ 38 - 0
src/main/java/com/example/cinema/po/MovieScheduleTime.java

@@ -0,0 +1,38 @@
+package com.example.cinema.po;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 6:09 PM
+ */
+public class MovieScheduleTime {
+    private Integer movieId;
+    /**
+     * 排片次数
+     */
+    private Integer time;
+    private String name;
+
+    public Integer getMovieId() {
+        return movieId;
+    }
+
+    public void setMovieId(Integer movieId) {
+        this.movieId = movieId;
+    }
+
+    public Integer getTime() {
+        return time;
+    }
+
+    public void setTime(Integer time) {
+        this.time = time;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 38 - 0
src/main/java/com/example/cinema/po/MovieTotalBoxOffice.java

@@ -0,0 +1,38 @@
+package com.example.cinema.po;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 6:09 PM
+ */
+public class MovieTotalBoxOffice {
+    private Integer movieId;
+    /**
+     * 票房(单位:元),(PS:如果后续数据量大,可自行处理单位,如改成单位:万元)
+     */
+    private Integer boxOffice;
+    private String name;
+
+    public Integer getMovieId() {
+        return movieId;
+    }
+
+    public void setMovieId(Integer movieId) {
+        this.movieId = movieId;
+    }
+
+    public Integer getBoxOffice() {
+        return boxOffice;
+    }
+
+    public void setBoxOffice(Integer boxOffice) {
+        this.boxOffice = boxOffice;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}

+ 1 - 1
src/main/java/com/example/cinema/vo/ScheduleItem.java → src/main/java/com/example/cinema/po/ScheduleItem.java

@@ -1,4 +1,4 @@
-package com.example.cinema.vo;
+package com.example.cinema.po;
 
 import java.util.Date;
 

+ 35 - 0
src/main/java/com/example/cinema/vo/DateLikeVO.java

@@ -0,0 +1,35 @@
+package com.example.cinema.vo;
+
+import java.sql.Date;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 6:03 PM
+ */
+public class DateLikeVO {
+    /**
+     * 喜爱人数
+     */
+    private int likeNum;
+
+    /**
+     * 喜爱时间
+     */
+    private Date likeTime;
+
+    public int getLikeNum() {
+        return likeNum;
+    }
+
+    public void setLikeNum(int likeNum) {
+        this.likeNum = likeNum;
+    }
+
+    public Date getLikeTime() {
+        return likeTime;
+    }
+
+    public void setLikeTime(Date likeTime) {
+        this.likeTime = likeTime;
+    }
+}

+ 106 - 0
src/main/java/com/example/cinema/vo/ScheduleItemVO.java

@@ -0,0 +1,106 @@
+package com.example.cinema.vo;
+
+import java.util.Date;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 5:43 PM
+ */
+public class ScheduleItemVO {
+    /**
+     * id
+     */
+    private Integer id;
+    /**
+     * 影厅id
+     */
+    private Integer hallId;
+    /**
+     * 影厅名称
+     */
+    private String hallName;
+    /**
+     * 电影id
+     */
+    private Integer movieId;
+    /**
+     * 电影名
+     */
+    private String movieName;
+    /**
+     * 开始放映时间
+     */
+    private Date startTime;
+    /**
+     * 结束放映时间
+     */
+    private Date endTime;
+    /**
+     * 票价
+     */
+    private double fare;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getHallId() {
+        return hallId;
+    }
+
+    public void setHallId(Integer hallId) {
+        this.hallId = hallId;
+    }
+
+    public String getHallName() {
+        return hallName;
+    }
+
+    public void setHallName(String hallName) {
+        this.hallName = hallName;
+    }
+
+    public Integer getMovieId() {
+        return movieId;
+    }
+
+    public void setMovieId(Integer movieId) {
+        this.movieId = movieId;
+    }
+
+    public String getMovieName() {
+        return movieName;
+    }
+
+    public void setMovieName(String movieName) {
+        this.movieName = movieName;
+    }
+
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    public double getFare() {
+        return fare;
+    }
+
+    public void setFare(double fare) {
+        this.fare = fare;
+    }
+}

+ 5 - 3
src/main/java/com/example/cinema/vo/ScheduleVO.java

@@ -1,5 +1,7 @@
 package com.example.cinema.vo;
 
+import com.example.cinema.po.ScheduleItem;
+
 import java.util.Date;
 import java.util.List;
 
@@ -9,7 +11,7 @@ import java.util.List;
  */
 public class ScheduleVO {
     private Date date;
-    private List<ScheduleItem> scheduleItemList;
+    private List<ScheduleItemVO> scheduleItemList;
 
     public Date getDate() {
         return date;
@@ -19,11 +21,11 @@ public class ScheduleVO {
         this.date = date;
     }
 
-    public List<ScheduleItem> getScheduleItemList() {
+    public List<ScheduleItemVO> getScheduleItemList() {
         return scheduleItemList;
     }
 
-    public void setScheduleItemList(List<ScheduleItem> scheduleItemList) {
+    public void setScheduleItemList(List<ScheduleItemVO> scheduleItemList) {
         this.scheduleItemList = scheduleItemList;
     }
 }

+ 3 - 1
src/main/java/com/example/cinema/vo/ScheduleWithSeatVO.java

@@ -1,5 +1,7 @@
 package com.example.cinema.vo;
 
+import com.example.cinema.po.ScheduleItem;
+
 /**
  * Created by liying on 2019/4/21.
  */
@@ -7,7 +9,7 @@ public class ScheduleWithSeatVO {
     /**
      * 排片
      */
-    private ScheduleItem  scheduleItem;
+    private ScheduleItem scheduleItem;
     /**
      * 座位
      */

+ 2 - 0
src/main/java/com/example/cinema/vo/TicketWithScheduleVO.java

@@ -1,5 +1,7 @@
 package com.example.cinema.vo;
 
+import com.example.cinema.po.ScheduleItem;
+
 import java.sql.Timestamp;
 
 /**

+ 2 - 2
src/main/resources/application.yml

@@ -1,8 +1,8 @@
 spring:
   datasource:
-     url: jdbc:mysql://localhost:3306/cinema?serverTimezone=CTT&characterEncoding=UTF-8
+     url: jdbc:mysql://47.101.183.63:3306/cinema?serverTimezone=CTT&characterEncoding=UTF-8
      username: root
-     password: root
+     password: Yuantu123
      driver-class-name: com.mysql.cj.jdbc.Driver
      max-active: 200
      max-idle: 20

+ 1 - 1
src/main/resources/dataImpl/management/HallMapper.xml

@@ -8,7 +8,7 @@
         select * from hall where id = #{hallId}
     </select>
 
-    <resultMap id="Hall" type="com.example.cinema.vo.HallVO">
+    <resultMap id="Hall" type="com.example.cinema.po.Hall">
     </resultMap>
 
 </mapper>

+ 1 - 1
src/main/resources/dataImpl/management/MovieMapper.xml

@@ -52,7 +52,7 @@
         where id = #{id}
     </update>
 
-    <resultMap id="Movie" type="com.example.cinema.vo.MovieVO">
+    <resultMap id="Movie" type="com.example.cinema.po.Movie">
         <id column="id" property="id"></id>
         <result column="poster_url" property="posterUrl"></result>
         <result column="screen_writer" property="screenWriter"></result>

+ 1 - 1
src/main/resources/dataImpl/management/ScheduleMapper.xml

@@ -88,7 +88,7 @@
             order by end_time asc
     </select>
 
-    <resultMap id="ScheduleItem" type="com.example.cinema.vo.ScheduleItem">
+    <resultMap id="ScheduleItem" type="com.example.cinema.po.ScheduleItem">
         <id column="id" property="id"></id>
         <result column="hall_id" property="hallId"></result>
         <result column="movie_id" property="movieId"></result>

+ 3 - 3
src/main/resources/dataImpl/statistics/StatisticsMapper.xml

@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.example.cinema.data.statistics.StatisticsMapper">
-    <select id="selectMovieScheduleTimes" resultType="com.example.cinema.vo.MovieScheduleTimeVO">
+    <select id="selectMovieScheduleTimes" resultType="com.example.cinema.po.MovieScheduleTime">
         select movie_id as movieId, count(*) as time,name from
               (select * from schedule where start_time between #{date} and #{nextDate}) s,
               movie where s.movie_id = movie.id group by movieId
     </select>
 
-    <select id="selectMovieTotalBoxOffice" resultType="com.example.cinema.vo.MovieTotalBoxOfficeVO">
+    <select id="selectMovieTotalBoxOffice" resultType="com.example.cinema.po.MovieTotalBoxOffice">
         select movie.id as movieId, boxOffice,name from movie
         left join
           (select movie_id as movieId,sum(fare) as boxOffice from schedule
@@ -18,7 +18,7 @@
         order by boxOffice desc
     </select>
 
-    <select id="selectAudiencePrice" resultType="com.example.cinema.vo.AudiencePrice">
+    <select id="selectAudiencePrice" resultType="com.example.cinema.po.AudiencePrice">
         select user_id as userId, sum(fare) as totalPrice from schedule right join
               (select * from ticket where schedule_id in
               (select id from schedule where start_time between #{date} and #{nextDate}) and state = 1) t

+ 1 - 1
src/main/resources/dataImpl/user/AccountMapper.xml

@@ -9,6 +9,6 @@
         select * from user where username=#{username}
     </select>
 
-    <resultMap id="User" type="com.example.cinema.vo.UserVO">
+    <resultMap id="User" type="com.example.cinema.po.User">
     </resultMap>
 </mapper>