package com.movbooking.controller;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Calendar;
import java.util.concurrent.Callable;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.movbooking.dao.AreaDAO;
import com.movbooking.entity.Area;
import com.movbooking.entity.Arrangement;
import com.movbooking.entity.Cinema;
import com.movbooking.entity.CinemaDistribution;
import com.movbooking.entity.Movie;
import com.movbooking.entity.ShowingOfFilm;
import com.movbooking.entity.VideoHall;
import com.movbooking.services.AreaService;
import com.movbooking.services.ArrangementService;
import com.movbooking.services.CinemaDistributionService;
import com.movbooking.services.CinemaService;
import com.movbooking.services.HallService;
import com.movbooking.services.MovieService;
import com.movbooking.services.ShowingService;
import com.movbooking.util.DateStringToCalendar;
@Controller
public class TestController2 {
private static Logger logger = Logger.getLogger(UserController.class.getName());
@Autowired
private MovieService movieService;
@Autowired
private CinemaService cinemaService;
@Autowired
private HallService hallService;
@Autowired
private ShowingService showingService;
@Autowired
private AreaService areaService;
@Autowired
private CinemaDistributionService cinemaDistributionService;
@Autowired
private ArrangementService arrangementService;
@RequestMapping(value="/test/addAll", method=RequestMethod.GET, produces = "application/json; charset=utf-8")
@ResponseBody
public Callable<String> addAll(HttpServletRequest request, HttpServletResponse response) {
return new Callable<String>() {
@Override
public String call() throws Exception {
StringBuilder sball = new StringBuilder();
String[] paths = {"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/1.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/2.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/3.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/4.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/5.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/6.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/7.txt",
"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/movieInfo/8.txt"
};
System.out.println("-----------"+ "path length " + paths.length);
for (int i = 0; i < paths.length; i++) {
System.out.println(paths[i]);
String[] content = new String[7];
BufferedReader in = new BufferedReader(new FileReader(paths[i]));
String s;
int j = 0;
while((s = in.readLine()) != null && j < 7) {
content[j] = s;
j++;
}
in.close();
String movieName = content[0].substring(1);
String director = content[1];
String mainActor = content[2];
String type = content[3];
Integer minutes = Integer.parseInt(content[4]);
String dateString = content[5];
String desc = content[6];
Calendar date = DateStringToCalendar.dateStringToCalendar(dateString);
movieService.addMovie(new Movie(movieName, director, mainActor, type, minutes, date, desc));
}
Movie movie = movieService.getMovie(1);
sball.append(movie.toString());
sball.append("\n");
sball.append("\n");
/////////////////////////////////////////////////////
String[] paths5 = {"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/Area/area.txt"};
for (int i = 0; i < paths5.length; i++) {
String s;
String city;
String region;
Area area = new Area();
BufferedReader in = new BufferedReader(new FileReader(paths5[i]));
while((s = in.readLine()) != null) {
if (s.trim().split(" ").length != 2) {
continue;
}
city = s.trim().split(" ")[0];
region = s.trim().split(" ")[1];
area.setCity(city);
area.setArea(region);
areaService.addArea(area);
}
in.close();
}
///////////////////////////////////////////////////////
String[] paths2 = {"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/cinemaInfo/cinemaInfo.txt"};
for (int i = 0; i < paths2.length; i++) {
String[] content = new String[6];
BufferedReader in = new BufferedReader(new FileReader(paths2[i]));
String s;
int j = 0;
String cinemaName;
String city;
String area;
String location;
String desc;
String cimg;
while((s = in.readLine()) != null && j < 6) {
content[j] = s;
j++;
if (j == 6) {
j = 0;
cinemaName = content[1];
city = content[2].trim();
area = content[3].trim();
location = content[4];
desc = content[5];
cimg = "1.jpg";
cinemaService.addCinema(new Cinema(cinemaName, location, desc, cimg, city, area));
}
}
in.close();
}
Cinema cinema = cinemaService.getCinemaById(1);
sball.append(cinema.toString());
sball.append("\n");
sball.append("\n");
////////////////////////////////////////////////////
String[] paths3 = {"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/hallInfo/hallInfo.txt"};
Integer cinemaid;
Integer rowNum;
Integer hallNo;
Integer colNum;
String seatMatrix;
for (int i = 0; i < paths3.length; i++) {
String s;
BufferedReader in = new BufferedReader(new FileReader(paths3[i]));
String[] content = new String[5];
int j = 0;
while((s = in.readLine()) != null && j < 5) {
content[j] = s;
j++;
if (j == 5) {
j = 0;
cinemaid = Integer.parseInt(content[1]);
hallNo = Integer.parseInt(content[2]);
rowNum = Integer.parseInt(content[3]);
colNum = Integer.parseInt(content[4]);
StringBuilder sb = new StringBuilder();
for (int r = 0; r < rowNum; r++) {
s = in.readLine();
if (s.length() > colNum) {
s = s.substring(0, colNum);
}
if (s.length() < colNum) {
int initLen = s.length();
for (int k = initLen; k <= colNum; k++) {
s += "a";
}
}
sb.append(s);
}
seatMatrix = new String(sb);
hallService.addHall(new VideoHall(cinemaid, hallNo, rowNum, colNum, seatMatrix));
}
}
in.close();
}
VideoHall videoHall = hallService.getHall(1, 1);
sball.append(videoHall.toString());
sball.append("\n");
sball.append("\n");
/////////////////////////////////////////////////////
String[] paths7 = {"D:/eclipseWorkspace/MovieBooking/WebContent/data/test/cinema_movie_map/cinema_movie_map.txt"};
for (int i = 0; i < paths7.length; i++) {
String s;
Integer movieId;
Integer cineamId;
BufferedReader in = new BufferedReader(new FileReader(paths7[i]));
while((s = in.readLine()) != null) {
if (s.trim().split(" ").length != 2) {
continue;
}
cineamId = Integer.parseInt(s.split(" ")[0]);
movieId = Integer.parseInt(s.split(" ")[1]);
Cinema tcinema = cinemaService.getCinemaById(cineamId);
CinemaDistribution cinemaDistribution = new CinemaDistribution(tcinema.getCity().trim(), tcinema.getArea().trim(), movieId, tcinema);
cinemaDistributionService.addDistribution(cinemaDistribution);
}
in.close();
}
////////////////////////////////////////////////////
String[] paths4 = {"D:/eclipseWorkspace/MovieBooking/WebContent/data/test
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
毕业设计是高等教育阶段学生在完成学业前所进行的一项重要学术任务,旨在检验学生通过学习所获得的知识、技能以及对特定领域的深刻理解能力。这项任务通常要求学生运用所学专业知识,通过独立研究和创新,完成一个实际问题的解决方案或者开展一项有价值的项目。 首先,毕业设计的选择通常由学生根据个人兴趣、专业方向以及实际需求来确定。学生需要在导师的指导下明确研究目标、问题陈述,确立研究的范围和深度。毕业设计可以包括文献综述、需求分析、方案设计、实施与测试等多个阶段,以确保整个过程的科学性和系统性。 其次,毕业设计的完成通常需要学生具备一定的独立思考和解决问题的能力。在研究过程中,学生可能需要采用各种研究方法,如实验、调查、案例分析等,以获取必要的数据和信息。通过这些活动,学生能够培养扎实的专业技能,提升解决实际问题的实际能力。 第三,毕业设计的撰写是整个过程的重要组成部分。学生需要将研究过程、方法、结果以及结论等详细记录在毕业论文中,以展示其研究的全貌和成果。同时,撰写毕业设计还有助于提高学生的学术写作水平,培养清晰、逻辑的表达能力。 最后,毕业设计的评价通常由导师和相关专业人士进行。评价标准包括研究的创新性、实用性、方法的科学性以及论文的质量等方面。学生在毕业设计中获得的成绩也将直接影响其最终的学业成绩和学位授予。 总的来说,毕业设计是高等教育中的一项重要环节,通过此过程,学生不仅能够巩固所学知识,还能培养独立思考和解决问题的能力,为将来的职业发展奠定坚实的基础。
资源推荐
资源详情
资源评论
收起资源包目录
互联网电影售票系统.zip (15个子文件)
ABT-code
ShowingService.java 765B
TestController.java 4KB
UserService.java 1KB
CinemaDistributionService.java 653B
UserController.java 4KB
ChooseSeatService.java 2KB
CinemaController.java 4KB
SeatController.java 3KB
MovieController.java 3KB
TestController2.java 12KB
ArrangementService.java 533B
HallService.java 1KB
AreaService.java 455B
MovieService.java 3KB
CinemaService.java 5KB
共 15 条
- 1
资源评论
普通的一个普通猿
- 粉丝: 1462
- 资源: 1761
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功