|
|
@@ -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){
|