jacksenma 7 yıl önce
ebeveyn
işleme
6c2b8eaa48

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

@@ -13,11 +13,4 @@ public interface HallService {
      * @return
      */
     ResponseVO searchAllHall();
-
-    /**
-     * 搜索影厅
-     * @param id
-     * @return
-     */
-    HallVO getHallById(int id);
 }

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

@@ -90,10 +90,4 @@ public interface MovieService {
      */
     ResponseVO updateMovie(MovieForm updateMovieForm);
 
-    /**
-     * 根据id查找电影
-     * @param id
-     * @return
-     */
-    MovieVO getMovieById(int id);
 }

+ 0 - 6
src/main/java/com/example/cinema/bl/management/ScheduleService.java

@@ -67,10 +67,4 @@ public interface ScheduleService {
      */
     ResponseVO searchAudienceSchedule(int movieId);
 
-    /**
-     * 查询所有涉及到movieIdList中电影的排片信息
-     * @param movieIdList
-     * @return
-     */
-    List<ScheduleItem> getScheduleByMovieIdList(List<Integer> movieIdList);
 }

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

@@ -1,6 +1,7 @@
 package com.example.cinema.blImpl.management;
 
 import com.example.cinema.bl.management.HallService;
+import com.example.cinema.blImpl.management.schedule.HallServiceForBl;
 import com.example.cinema.data.management.HallMapper;
 import com.example.cinema.vo.HallVO;
 import com.example.cinema.vo.ResponseVO;
@@ -12,7 +13,7 @@ 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;
 

+ 7 - 4
src/main/java/com/example/cinema/blImpl/management/MovieServiceImpl.java

@@ -2,6 +2,8 @@ package com.example.cinema.blImpl.management;
 
 import com.example.cinema.bl.management.MovieService;
 import com.example.cinema.bl.management.ScheduleService;
+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.vo.*;
@@ -17,7 +19,7 @@ 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 = "用户未标记该电影为想看";
@@ -29,7 +31,7 @@ public class MovieServiceImpl implements MovieService {
     @Autowired
     private MovieLikeMapper movieLikeMapper;
     @Autowired
-    private ScheduleService scheduleService;
+    private ScheduleServiceForBl scheduleServiceForBl;
 
     @Override
     public ResponseVO addMovie(MovieForm addMovieForm) {
@@ -118,8 +120,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));
     }
 
@@ -183,7 +186,7 @@ public class MovieServiceImpl implements MovieService {
      */
     public ResponseVO preCheck(List<Integer> movieIdList){
         Date thisTime = new Date();
-        List<ScheduleItem> scheduleItems = scheduleService.getScheduleByMovieIdList(movieIdList);
+        List<ScheduleItem> scheduleItems = scheduleServiceForBl.getScheduleByMovieIdList(movieIdList);
 
         // 检查是否有电影后续有排片及是否有观众购票未使用
         for(ScheduleItem s : scheduleItems){

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

@@ -0,0 +1,16 @@
+package com.example.cinema.blImpl.management.schedule;
+
+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);
+}

+ 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);
+}

+ 16 - 6
src/main/java/com/example/cinema/blImpl/management/ScheduleServiceImpl.java → src/main/java/com/example/cinema/blImpl/management/schedule/ScheduleServiceImpl.java

@@ -1,4 +1,4 @@
-package com.example.cinema.blImpl.management;
+package com.example.cinema.blImpl.management.schedule;
 
 import com.example.cinema.bl.management.HallService;
 import com.example.cinema.bl.management.MovieService;
@@ -17,7 +17,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 +33,9 @@ public class ScheduleServiceImpl implements ScheduleService {
     @Autowired
     private ScheduleMapper scheduleMapper;
     @Autowired
-    private MovieService movieService;
+    private MovieServiceForBl movieServiceForBl;
     @Autowired
-    private HallService hallService;
+    private HallServiceForBl hallServiceForBl;
 
 
     @Override
@@ -134,6 +134,16 @@ public class ScheduleServiceImpl implements ScheduleService {
 
     }
 
+    @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 {
@@ -229,12 +239,12 @@ public class ScheduleServiceImpl implements ScheduleService {
             }
 
             //检查影厅是否存在
-            if(hallService.getHallById(scheduleForm.getHallId()) == null){
+            if(hallServiceForBl.getHallById(scheduleForm.getHallId()) == null){
                 return ResponseVO.buildFailure(HALL_NOT_EXIST_ERROR_MESSAGE);
             }
 
             // 检查电影是否存在
-            MovieVO movieVO = movieService.getMovieById(scheduleForm.getMovieId());
+            MovieVO movieVO = movieServiceForBl.getMovieById(scheduleForm.getMovieId());
             if(movieVO == null){
                 return ResponseVO.buildFailure(MOVIE_NOT_EXIST_ERROR_MESSAGE);
             }

+ 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中电影的排片信息