13 İşlemeler ce11f3682a ... 16a2d6dccf

Yazar SHA1 Mesaj Tarih
  liying 16a2d6dccf Merge branch 'master' into feature-blank 7 yıl önce
  jacksenma 27f0a5efb1 修改 7 yıl önce
  jacksenma a5a7f6e822 修改 7 yıl önce
  jacksenma 9dcf846366 修改 7 yıl önce
  liying a4f5f808ee Merge remote-tracking branch 'origin/master' 7 yıl önce
  liying 3a53ac8b61 [修改]修改ticketService对其他service的依赖 7 yıl önce
  jacksenma 75a5f29e61 修改 7 yıl önce
  jacksenma f21d99a6c0 修改 7 yıl önce
  jacksenma 6c2b8eaa48 修改 7 yıl önce
  liying 5f65b4726c [修改]修改service 7 yıl önce
  jacksenma 67bb6695e1 修改 7 yıl önce
  jacksenma 162b3e1a8b 修改 7 yıl önce
  jacksenma 5f6f19dec3 两个getById 7 yıl önce

+ 1 - 0
src/main/java/com/example/cinema/bl/management/HallService.java

@@ -1,5 +1,6 @@
 package com.example.cinema.bl.management;
 
+import com.example.cinema.vo.HallVO;
 import com.example.cinema.vo.ResponseVO;
 
 /**

+ 3 - 0
src/main/java/com/example/cinema/bl/management/MovieService.java

@@ -2,7 +2,9 @@ package com.example.cinema.bl.management;
 
 import com.example.cinema.vo.MovieBatchOffForm;
 import com.example.cinema.vo.MovieForm;
+import com.example.cinema.vo.MovieVO;
 import com.example.cinema.vo.ResponseVO;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * @author fjj
@@ -87,4 +89,5 @@ public interface MovieService {
      * @return
      */
     ResponseVO updateMovie(MovieForm updateMovieForm);
+
 }

+ 2 - 4
src/main/java/com/example/cinema/bl/management/ScheduleService.java

@@ -1,9 +1,6 @@
 package com.example.cinema.bl.management;
 
-import com.example.cinema.vo.ResponseVO;
-import com.example.cinema.vo.ScheduleBatchDeleteForm;
-import com.example.cinema.vo.ScheduleForm;
-import com.example.cinema.vo.ScheduleViewForm;
+import com.example.cinema.vo.*;
 
 import java.util.Date;
 
@@ -68,4 +65,5 @@ public interface ScheduleService {
      * @return
      */
     ResponseVO searchAudienceSchedule(int movieId);
+
 }

+ 4 - 2
src/main/java/com/example/cinema/bl/statistics/StatisticsService.java

@@ -31,15 +31,17 @@ public interface StatisticsService {
 
 
     /**
-     * 获取所有电影某天的上座率
+     * TODO:获取所有电影某天的上座率
      * 上座率参考公式:假设某影城设有n 个电影厅、m 个座位数,相对上座率=观众人次÷放映场次÷m÷n×100%
+     * 此方法中运用到的相应的操作数据库的接口和实现请自行定义和实现,相应的结果需要自己定义一个VO类返回给前端
      * @param date
      * @return
      */
     ResponseVO getMoviePlacingRateByDate(Date date);
 
     /**
-     * 获取最近days天内,最受欢迎的movieNum个电影(可以简单理解为最近days内票房越高的电影越受欢迎)
+     * TODO:获取最近days天内,最受欢迎的movieNum个电影(可以简单理解为最近days内票房越高的电影越受欢迎)
+     * 此方法中运用到的相应的操作数据库的接口和实现请自行定义和实现,相应的结果需要自己定义一个VO类返回给前端
      * @param days
      * @param movieNum
      * @return

+ 16 - 0
src/main/java/com/example/cinema/blImpl/management/hall/HallServiceForBl.java

@@ -0,0 +1,16 @@
+package com.example.cinema.blImpl.management.hall;
+
+import com.example.cinema.vo.HallVO;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 12:27 AM
+ */
+public interface HallServiceForBl {
+    /**
+     * 搜索影厅
+     * @param id
+     * @return
+     */
+    HallVO getHallById(int id);
+}

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

@@ -1,7 +1,8 @@
-package com.example.cinema.blImpl.management;
+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.vo.HallVO;
 import com.example.cinema.vo.ResponseVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -11,9 +12,10 @@ import org.springframework.stereotype.Service;
  * @date 2019/4/12 2:01 PM
  */
 @Service
-public class HallServiceImpl implements HallService {
+public class HallServiceImpl implements HallService, HallServiceForBl {
     @Autowired
     private HallMapper hallMapper;
+
     @Override
     public ResponseVO searchAllHall() {
         try {
@@ -23,4 +25,15 @@ public class HallServiceImpl implements HallService {
             return ResponseVO.buildFailure("失败");
         }
     }
+
+    @Override
+    public HallVO getHallById(int id) {
+        try {
+            return hallMapper.selectHallById(id);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return null;
+        }
+
+    }
 }

+ 20 - 15
src/main/java/com/example/cinema/blImpl/management/MovieServiceImpl.java → src/main/java/com/example/cinema/blImpl/management/movie/MovieServiceImpl.java

@@ -1,15 +1,11 @@
-package com.example.cinema.blImpl.management;
+package com.example.cinema.blImpl.management.movie;
 
 import com.example.cinema.bl.management.MovieService;
-import com.example.cinema.data.user.AccountMapper;
+import com.example.cinema.blImpl.management.schedule.MovieServiceForBl;
+import com.example.cinema.blImpl.management.schedule.ScheduleServiceForBl;
 import com.example.cinema.data.statistics.MovieLikeMapper;
 import com.example.cinema.data.management.MovieMapper;
-
-import com.example.cinema.data.management.ScheduleMapper;
-import com.example.cinema.vo.MovieBatchOffForm;
-import com.example.cinema.vo.MovieForm;
-import com.example.cinema.vo.ResponseVO;
-import com.example.cinema.vo.ScheduleItem;
+import com.example.cinema.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -22,11 +18,10 @@ import java.util.List;
  * @date 2019/3/12 6:43 PM
  */
 @Service
-public class MovieServiceImpl implements MovieService {
+public class MovieServiceImpl implements MovieService, MovieServiceForBl {
 
     private static final String ALREADY_LIKE_ERROR_MESSAGE = "用户已标记该电影为想看";
     private static final String UNLIKE_ERROR_MESSAGE = "用户未标记该电影为想看";
-    private static final String USER_NOT_EXIST_ERROR_MESSAGE = "用户不存在";
     private static final String MOVIE_NOT_EXIST_ERROR_MESSAGE = "电影不存在";
     private static final String SCHEDULE_ERROR_MESSAGE = "有电影后续仍有排片或已有观众购票且未使用";
 
@@ -35,9 +30,7 @@ public class MovieServiceImpl implements MovieService {
     @Autowired
     private MovieLikeMapper movieLikeMapper;
     @Autowired
-    private AccountMapper accountMapper;
-    @Autowired
-    private ScheduleMapper scheduleMapper;
+    private ScheduleServiceForBl scheduleServiceForBl;
 
     @Override
     public ResponseVO addMovie(MovieForm addMovieForm) {
@@ -126,8 +119,9 @@ public class MovieServiceImpl implements MovieService {
 
     @Override
     public ResponseVO getMovieByKeyword(String keyword) {
-        if (keyword==null||keyword.equals(""))
+        if (keyword==null||keyword.equals("")){
             return ResponseVO.buildSuccess(movieMapper.selectAllMovie());
+        }
         return ResponseVO.buildSuccess(movieMapper.selectMovieByKeyword(keyword));
     }
 
@@ -173,6 +167,17 @@ public class MovieServiceImpl implements MovieService {
         }
     }
 
+    @Override
+    public MovieVO getMovieById(int id) {
+        try {
+            return movieMapper.selectMovieById(id);
+        }catch (Exception e){
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
     /**
      * 下架和修改电影的前置检查
      * @param movieIdList
@@ -180,7 +185,7 @@ public class MovieServiceImpl implements MovieService {
      */
     public ResponseVO preCheck(List<Integer> movieIdList){
         Date thisTime = new Date();
-        List<ScheduleItem> scheduleItems = scheduleMapper.selectScheduleByMovieIdList(movieIdList);
+        List<ScheduleItem> scheduleItems = scheduleServiceForBl.getScheduleByMovieIdList(movieIdList);
 
         // 检查是否有电影后续有排片及是否有观众购票未使用
         for(ScheduleItem s : scheduleItems){

+ 16 - 0
src/main/java/com/example/cinema/blImpl/management/schedule/MovieServiceForBl.java

@@ -0,0 +1,16 @@
+package com.example.cinema.blImpl.management.schedule;
+
+import com.example.cinema.vo.MovieVO;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 12:29 AM
+ */
+public interface MovieServiceForBl {
+    /**
+     * 根据id查找电影
+     * @param id
+     * @return
+     */
+    MovieVO getMovieById(int id);
+}

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

@@ -0,0 +1,25 @@
+package com.example.cinema.blImpl.management.schedule;
+
+import com.example.cinema.vo.ScheduleItem;
+
+import java.util.List;
+
+/**
+ * @author fjj
+ * @date 2019/4/28 12:30 AM
+ */
+public interface ScheduleServiceForBl {
+    /**
+     * 查询所有涉及到movieIdList中电影的排片信息
+     * @param movieIdList
+     * @return
+     */
+    List<ScheduleItem> getScheduleByMovieIdList(List<Integer> movieIdList);
+
+    /**
+     * 根据id查找排片信息
+     * @param id
+     * @return
+     */
+    ScheduleItem getScheduleItemById(int id);
+}

+ 30 - 11
src/main/java/com/example/cinema/blImpl/management/ScheduleServiceImpl.java → src/main/java/com/example/cinema/blImpl/management/schedule/ScheduleServiceImpl.java

@@ -1,8 +1,7 @@
-package com.example.cinema.blImpl.management;
+package com.example.cinema.blImpl.management.schedule;
 
 import com.example.cinema.bl.management.ScheduleService;
-import com.example.cinema.data.management.HallMapper;
-import com.example.cinema.data.management.MovieMapper;
+import com.example.cinema.blImpl.management.hall.HallServiceForBl;
 import com.example.cinema.data.management.ScheduleMapper;
 import com.example.cinema.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +16,7 @@ import java.util.*;
  * @date 2019/4/11 4:14 PM
  */
 @Service
-public class ScheduleServiceImpl implements ScheduleService {
+public class ScheduleServiceImpl implements ScheduleService, ScheduleServiceForBl {
     private static final String TIME_CONFLICT_ERROR_MESSAGE = "时间段冲突";
     private static final String CROSS_DAYS_ERROR_MESSAGE = "起止时间不能跨天";
     private static final String DATE_INTERVAL_LESS_THAN_LENGTH_ERROR_MESSAGE = "起止时间段不能少于电影时长或结束时间不能早于开始时间";
@@ -33,9 +32,10 @@ public class ScheduleServiceImpl implements ScheduleService {
     @Autowired
     private ScheduleMapper scheduleMapper;
     @Autowired
-    private MovieMapper movieMapper;
+    private MovieServiceForBl movieServiceForBl;
     @Autowired
-    private HallMapper hallMapper;
+    private HallServiceForBl hallServiceForBl;
+
 
     @Override
     public ResponseVO addSchedule(ScheduleForm scheduleForm) {
@@ -122,6 +122,27 @@ public class ScheduleServiceImpl implements ScheduleService {
         }
     }
 
+    @Override
+    public List<ScheduleItem> getScheduleByMovieIdList(List<Integer> movieIdList) {
+        try {
+            return scheduleMapper.selectScheduleByMovieIdList(movieIdList);
+        }catch (Exception e){
+            e.printStackTrace();
+            return null;
+        }
+
+    }
+
+    @Override
+    public ScheduleItem getScheduleItemById(int id) {
+        try {
+            return scheduleMapper.selectScheduleById(id);
+        }catch (Exception e){
+            e.printStackTrace();
+            return null;
+        }
+    }
+
     @Override
     public ResponseVO searchScheduleSevenDays(int hallId, Date startDate) {
         try {
@@ -184,15 +205,13 @@ public class ScheduleServiceImpl implements ScheduleService {
     }
 
 
-
     /**
      * 获得num天后的日期
      * @param oldDate
      * @param num
      * @return
-     * @throws ParseException
      */
-    Date getNumDayAfterDate(Date oldDate, int num) throws ParseException {
+    Date getNumDayAfterDate(Date oldDate, int num){
         Calendar calendarTime = Calendar.getInstance();
         calendarTime.setTime(oldDate);
         calendarTime.add(Calendar.DAY_OF_YEAR, num);
@@ -219,12 +238,12 @@ public class ScheduleServiceImpl implements ScheduleService {
             }
 
             //检查影厅是否存在
-            if(hallMapper.selectHallById(scheduleForm.getHallId()) == null){
+            if(hallServiceForBl.getHallById(scheduleForm.getHallId()) == null){
                 return ResponseVO.buildFailure(HALL_NOT_EXIST_ERROR_MESSAGE);
             }
 
             // 检查电影是否存在
-            MovieVO movieVO = movieMapper.selectMovieById(scheduleForm.getMovieId());
+            MovieVO movieVO = movieServiceForBl.getMovieById(scheduleForm.getMovieId());
             if(movieVO == null){
                 return ResponseVO.buildFailure(MOVIE_NOT_EXIST_ERROR_MESSAGE);
             }

+ 7 - 12
src/main/java/com/example/cinema/blImpl/sales/TicketServiceImpl.java

@@ -1,8 +1,8 @@
 package com.example.cinema.blImpl.sales;
 
 import com.example.cinema.bl.sales.TicketService;
-import com.example.cinema.data.management.HallMapper;
-import com.example.cinema.data.management.ScheduleMapper;
+import com.example.cinema.blImpl.management.hall.HallServiceForBl;
+import com.example.cinema.blImpl.management.schedule.ScheduleServiceForBl;
 import com.example.cinema.data.promotion.ActivityMapper;
 import com.example.cinema.data.promotion.CouponMapper;
 import com.example.cinema.data.promotion.VIPCardMapper;
@@ -24,15 +24,9 @@ public class TicketServiceImpl implements TicketService {
     @Autowired
     TicketMapper ticketMapper;
     @Autowired
-    VIPCardMapper vipCardMapper;
+    ScheduleServiceForBl scheduleService;
     @Autowired
-    ScheduleMapper scheduleMapper;
-    @Autowired
-    CouponMapper couponMapper;
-    @Autowired
-    HallMapper hallmapper;
-    @Autowired
-    ActivityMapper activityMapper;
+    HallServiceForBl hallService;
 
     @Override
     @Transactional
@@ -50,8 +44,8 @@ public class TicketServiceImpl implements TicketService {
     public ResponseVO getBySchedule(int scheduleId) {
         try {
             List<Ticket> tickets = ticketMapper.selectTicketsBySchedule(scheduleId);
-            ScheduleItem schedule=scheduleMapper.selectScheduleById(scheduleId);
-            HallVO hall=hallmapper.selectHallById(schedule.getHallId());
+            ScheduleItem schedule=scheduleService.getScheduleItemById(tickets.get(0).getScheduleId());
+            HallVO hall=hallService.getHallById(schedule.getHallId());
             int[][] seats=new int[hall.getRow()][hall.getColumn()];
             tickets.stream().forEach(ticket -> {
                 seats[ticket.getRowIndex()][ticket.getColumnIndex()]=1;
@@ -69,6 +63,7 @@ public class TicketServiceImpl implements TicketService {
     @Override
     public ResponseVO getTicketByUser(int userId) {
         return null;
+
     }
 
     @Override

+ 3 - 2
src/main/java/com/example/cinema/blImpl/statistics/StatisticsServiceImpl.java

@@ -79,11 +79,13 @@ public class StatisticsServiceImpl implements StatisticsService {
 
     @Override
     public ResponseVO getMoviePlacingRateByDate(Date date) {
+        //要求见接口说明
         return null;
     }
 
     @Override
     public ResponseVO getPopularMovies(int days, int movieNum) {
+        //要求见接口说明
         return null;
     }
 
@@ -93,9 +95,8 @@ public class StatisticsServiceImpl implements StatisticsService {
      * @param oldDate
      * @param num
      * @return
-     * @throws ParseException
      */
-    Date getNumDayAfterDate(Date oldDate, int num) throws ParseException {
+    Date getNumDayAfterDate(Date oldDate, int num){
         Calendar calendarTime = Calendar.getInstance();
         calendarTime.setTime(oldDate);
         calendarTime.add(Calendar.DAY_OF_YEAR, num);

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

@@ -2,6 +2,7 @@ package com.example.cinema.data.management;
 
 import com.example.cinema.vo.HallVO;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -21,5 +22,5 @@ public interface HallMapper {
      * 根据id查询影厅
      * @return
      */
-    HallVO selectHallById(int hallId);
+    HallVO selectHallById(@Param("hallId") int hallId);
 }

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

@@ -95,7 +95,7 @@ public interface ScheduleMapper {
      * @param id
      * @return
      */
-    ScheduleItem selectScheduleById(int id);
+    ScheduleItem selectScheduleById(@Param("id") int id);
 
     /**
      * 查询所有涉及到movieIdList中电影的排片信息