Compare commits
No commits in common. 'sjr' and 'master' have entirely different histories.
@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-22 (2)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/.idea.iml" filepath="$PROJECT_DIR$/.idea/.idea.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="GrUnresolvedAccess" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" project-jdk-name="openjdk-22 (2)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/images.iml" filepath="$PROJECT_DIR$/.idea/images.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,8 @@
|
||||
package com.rabbiter.cm.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class ApplicationConfiguration {
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.rabbiter.cm.common.config;
|
||||
|
||||
import com.rabbiter.cm.common.utils.PathUtils;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
@Configuration
|
||||
public class CorsConfig implements WebMvcConfigurer {
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
config.setAllowedOriginPatterns(Collections.singletonList("*"));
|
||||
config.addAllowedMethod("*");
|
||||
config.addAllowedHeader("*");
|
||||
config.setAllowCredentials(true);
|
||||
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
String path = PathUtils.getClassLoadRootPath() + "/images/";
|
||||
|
||||
//第一个方法设置访问路径前缀,第二个方法设置资源路径
|
||||
registry.addResourceHandler("/images/**").
|
||||
addResourceLocations("file:" + path);
|
||||
WebMvcConfigurer.super.addResourceHandlers(registry);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.rabbiter.cm.common.config;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
import com.alibaba.druid.pool.ExceptionSorter;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Description
|
||||
* Author:
|
||||
* Date: 2024/2/26 23:39
|
||||
**/
|
||||
@Configuration
|
||||
// 配置mybatis的扫描路径
|
||||
@MapperScan("com.rabbiter.sms.dao")
|
||||
public class DataSourceConfiguration {
|
||||
@Value("${spring.datasource.driver-class-name}")
|
||||
private String jdbcDriver;
|
||||
@Value("${spring.datasource.druid.url}")
|
||||
private String jdbcUrl;
|
||||
@Value("${spring.datasource.druid.username}")
|
||||
private String jdbcUsername;
|
||||
@Value("${spring.datasource.druid.password}")
|
||||
private String jdbcPassword;
|
||||
|
||||
@Bean(name="dataSource")
|
||||
public DruidDataSource createDataSource() throws Exception {
|
||||
DruidDataSource dataSource = new DruidDataSource();
|
||||
dataSource.setDriverClassName(jdbcDriver);
|
||||
dataSource.setUrl(jdbcUrl);
|
||||
dataSource.setUsername(jdbcUsername);
|
||||
dataSource.setPassword(jdbcPassword);
|
||||
|
||||
// 关闭连接后不自动commit
|
||||
dataSource.setDefaultAutoCommit(false);
|
||||
// 设置连接异常处理
|
||||
dataSource.setBreakAfterAcquireFailure(true);
|
||||
// 将SQLException抛出重要配置
|
||||
dataSource.setFailFast(true);
|
||||
dataSource.setConnectionErrorRetryAttempts(0);
|
||||
// 配置自定义的异常处理器
|
||||
dataSource.setExceptionSorter(new CustomExceptionSorter());
|
||||
|
||||
// 关闭Druid连接池内部的异常处理
|
||||
// dataSource.setFilters("stat");
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CustomExceptionSorter implements ExceptionSorter {
|
||||
|
||||
@Override
|
||||
public boolean isExceptionFatal(SQLException e) {
|
||||
// 将所有异常视为致命异常,即抛出到上层
|
||||
// 打印异常堆栈信息
|
||||
e.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configFromProperties(Properties properties) {
|
||||
// 配置信息可以为空
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.rabbiter.cm.common.config;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.ServletContextAware;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
@Component
|
||||
public class ProcessContextAware implements ServletContextAware {
|
||||
@Value("${server.port}")
|
||||
private String port;
|
||||
|
||||
@Override
|
||||
public void setServletContext(ServletContext servletContext) {
|
||||
try {
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
|
||||
if (os.contains("win")) {
|
||||
// Windows系统关闭占用指定端口的逻辑
|
||||
ProcessBuilder processBuilder = new ProcessBuilder("cmd.exe", "/c", "netstat -ano | findstr " + port);
|
||||
Process process = processBuilder.start();
|
||||
InputStream inputStream = process.getInputStream();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
String[] tokens = line.trim().split("\\s+");
|
||||
String pid = tokens[tokens.length - 1];
|
||||
ProcessBuilder killProcess = new ProcessBuilder("cmd.exe", "/c", "taskkill /F /PID " + pid);
|
||||
killProcess.start();
|
||||
}
|
||||
} else if (os.contains("nix") || os.contains("nux") || os.contains("mac")) {
|
||||
// Linux或Mac OS系统关闭占用指定端口的逻辑
|
||||
ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c", "lsof -ti:" + port + " | xargs kill -9");
|
||||
processBuilder.start();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.rabbiter.cm.common.constant;
|
||||
|
||||
|
||||
public class MovieRankingList {
|
||||
|
||||
public static final String[] listNames = new String[3];
|
||||
|
||||
static {
|
||||
listNames[0] = "totalBoxOfficeList";
|
||||
listNames[1] = "domesticBoxOfficeList";
|
||||
listNames[2] = "foreignBoxOfficeList";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.rabbiter.cm.common.exception;
|
||||
|
||||
public class DataNotFoundException extends RuntimeException {
|
||||
|
||||
static final long serialVersionUID = -7034897190745456227L;
|
||||
|
||||
public DataNotFoundException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public DataNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.rabbiter.cm.common.exception;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseBody
|
||||
public ResponseEntity<String> handleException(Exception e) {
|
||||
// 自定义异常处理逻辑
|
||||
String message = e.getMessage();
|
||||
e.printStackTrace();
|
||||
if (message.contains("(using password: YES)")) {
|
||||
if (!message.contains("'root'@'")) {
|
||||
message = "PU Request failed with status code 500";
|
||||
} else if (message.contains("'root'@'localhost'")) {
|
||||
message = "P Request failed with status code 500";
|
||||
}
|
||||
} else if(message.contains("Table") && message.contains("doesn't exist")) {
|
||||
message = "T Request failed with status code 500";
|
||||
} else if (message.contains("Unknown database")) {
|
||||
message = "U Request failed with status code 500";
|
||||
} else if (message.contains("edis")) {
|
||||
message = "R Request failed with status code 500";
|
||||
} else if (message.contains("Failed to obtain JDBC Connection")) {
|
||||
message = "C Request failed with status code 500";
|
||||
} else if (message.contains("SQLSyntaxErrorException")) {
|
||||
message = "S Request failed with status code 500";
|
||||
}
|
||||
return new ResponseEntity<>(message, HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,206 @@
|
||||
package com.rabbiter.cm.common.file;
|
||||
|
||||
import com.rabbiter.cm.common.exception.FileNameLengthLimitExceededException;
|
||||
import com.rabbiter.cm.common.exception.FileSizeLimitExceededException;
|
||||
import com.rabbiter.cm.common.exception.InvalidExtensionException;
|
||||
import com.rabbiter.cm.common.utils.PathUtils;
|
||||
import com.rabbiter.cm.common.utils.StringUtil;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.time.DateFormatUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 文件上传工具类
|
||||
*/
|
||||
public class FileUploadUtils {
|
||||
/**
|
||||
* 默认大小 50M
|
||||
*/
|
||||
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
|
||||
|
||||
/**
|
||||
* 默认的文件名最大长度 100
|
||||
*/
|
||||
public static final int DEFAULT_FILE_NAME_LENGTH = 100;
|
||||
|
||||
/**
|
||||
* 默认存储图片目录
|
||||
*/
|
||||
private static final String parentPath = PathUtils.getClassLoadRootPath() + "/images";
|
||||
|
||||
public static final String actorPath = "/actor";
|
||||
public static final String cinemaPath = "/cinema";
|
||||
public static final String moviePath = "/movie";
|
||||
public static final String userPath = "/user";
|
||||
|
||||
|
||||
/**
|
||||
* 默认上传的地址
|
||||
*/
|
||||
private static String defaultBaseDir = userPath;
|
||||
|
||||
public static void setDefaultBaseDir(String defaultBaseDir) {
|
||||
FileUploadUtils.defaultBaseDir = defaultBaseDir;
|
||||
}
|
||||
|
||||
public static String getDefaultBaseDir() {
|
||||
return defaultBaseDir;
|
||||
}
|
||||
|
||||
public static String getParentPath() {
|
||||
return parentPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 以默认配置进行文件上传
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return 文件名称
|
||||
* @throws Exception
|
||||
*/
|
||||
public static final String upload(MultipartFile file) throws IOException {
|
||||
try {
|
||||
return upload(getParentPath() + getDefaultBaseDir(), file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
||||
} catch (Exception e) {
|
||||
throw new IOException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param baseDir 相对应用的基目录
|
||||
* @param file 上传的文件
|
||||
* @param allowedExtension 上传文件类型
|
||||
* @return 返回上传成功的文件名
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws FileNameLengthLimitExceededException 文件名太长
|
||||
* @throws IOException 比如读写文件出错时
|
||||
* @throws InvalidExtensionException 文件校验异常
|
||||
*/
|
||||
public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
|
||||
InvalidExtensionException {
|
||||
int fileNamelength = file.getOriginalFilename().length();
|
||||
if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) {
|
||||
throw new FileNameLengthLimitExceededException("文件名称长度不能超过" + FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
|
||||
}
|
||||
|
||||
assertAllowed(file, allowedExtension);
|
||||
|
||||
String fileName = extractFilename(file);
|
||||
|
||||
File desc = getAbsoluteFile(baseDir, fileName);
|
||||
file.transferTo(desc);
|
||||
String pathFileName = getPathFileName(baseDir, fileName);
|
||||
return pathFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编码文件名 如 : images/user/2021/3/4/***.png
|
||||
*/
|
||||
public static final String extractFilename(MultipartFile file) {
|
||||
String fileName = file.getOriginalFilename();
|
||||
String extension = getExtension(file);
|
||||
fileName = DateFormatUtils.format(new Date(), "yyyy/MM/dd") + "/" + UUID.randomUUID().toString().replaceAll("-", "") + "." + extension;
|
||||
return fileName;
|
||||
}
|
||||
|
||||
private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException {
|
||||
File desc = new File(uploadDir + File.separator + fileName);
|
||||
|
||||
if (!desc.getParentFile().exists()) {
|
||||
desc.getParentFile().mkdirs();
|
||||
}
|
||||
if (!desc.exists()) {
|
||||
desc.createNewFile();
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
private static final String getPathFileName(String uploadDir, String fileName) throws IOException {
|
||||
int dirLastIndex = parentPath.length() + 1;
|
||||
String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
|
||||
String pathFileName = "/images/" + currentDir + "/" + fileName;
|
||||
return pathFileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件大小校验
|
||||
*
|
||||
* @param file 上传的文件
|
||||
* @return
|
||||
* @throws FileSizeLimitExceededException 如果超出最大大小
|
||||
* @throws InvalidExtensionException
|
||||
*/
|
||||
public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
|
||||
throws FileSizeLimitExceededException, InvalidExtensionException {
|
||||
long size = file.getSize();
|
||||
if (DEFAULT_MAX_SIZE != -1 && size > DEFAULT_MAX_SIZE) {
|
||||
throw new FileSizeLimitExceededException("文件大小不能超过" + DEFAULT_MAX_SIZE / 1024 / 1024 + "MB");
|
||||
}
|
||||
|
||||
String fileName = file.getOriginalFilename();
|
||||
String extension = getExtension(file);
|
||||
if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension)) {
|
||||
if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION) {
|
||||
throw new InvalidExtensionException("图片格式不支持" + extension + "格式");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断MIME类型是否是允许的MIME类型
|
||||
*
|
||||
* @param extension
|
||||
* @param allowedExtension
|
||||
* @return
|
||||
*/
|
||||
public static final boolean isAllowedExtension(String extension, String[] allowedExtension) {
|
||||
for (String str : allowedExtension) {
|
||||
if (str.equalsIgnoreCase(extension)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件名的后缀
|
||||
*
|
||||
* @param file 表单文件
|
||||
* @return 后缀名
|
||||
*/
|
||||
public static final String getExtension(MultipartFile file) {
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
if (!StringUtil.isNotEmpty(extension)) {
|
||||
extension = MimeTypeUtils.getExtension(file.getContentType());
|
||||
}
|
||||
return extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param filePath 文件
|
||||
* @return
|
||||
*/
|
||||
public static boolean deleteFile(String filePath) {
|
||||
boolean flag = false;
|
||||
File file = new File(filePath);
|
||||
// 路径为文件且不为空则进行删除
|
||||
if (file.isFile() && file.exists()) {
|
||||
file.delete();
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.rabbiter.cm.common.file;
|
||||
|
||||
/**
|
||||
* 媒体类型工具类
|
||||
*/
|
||||
public class MimeTypeUtils {
|
||||
|
||||
public static final String IMAGE_PNG = "image/png";
|
||||
|
||||
public static final String IMAGE_JPG = "image/jpg";
|
||||
|
||||
public static final String IMAGE_JPEG = "image/jpeg";
|
||||
|
||||
public static final String IMAGE_BMP = "image/bmp";
|
||||
|
||||
public static final String IMAGE_GIF = "image/gif";
|
||||
|
||||
public static final String[] IMAGE_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};
|
||||
|
||||
public static final String[] DEFAULT_ALLOWED_EXTENSION = {"bmp", "gif", "jpg", "jpeg", "png"};
|
||||
|
||||
public static String getExtension(String prefix) {
|
||||
switch (prefix) {
|
||||
case IMAGE_PNG:
|
||||
return "png";
|
||||
case IMAGE_JPG:
|
||||
return "jpg";
|
||||
case IMAGE_JPEG:
|
||||
return "jpeg";
|
||||
case IMAGE_BMP:
|
||||
return "bmp";
|
||||
case IMAGE_GIF:
|
||||
return "gif";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.rabbiter.cm.common.page;
|
||||
|
||||
import com.rabbiter.cm.common.utils.StringUtil;
|
||||
|
||||
/**
|
||||
* 获取分页请求参数的实体类
|
||||
*/
|
||||
public class Page {
|
||||
|
||||
//页码
|
||||
private Integer pageNum = 1;
|
||||
|
||||
//页大小
|
||||
private Integer pageSize = 1000;
|
||||
|
||||
//按列排序
|
||||
private String orderByColumn;
|
||||
|
||||
//升序还是降序,"asc"表示升序(默认)、"desc"表示降序
|
||||
private String isAsc = "asc";
|
||||
|
||||
public Integer getPageNum() {
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum) {
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize() {
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize) {
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将isAsc拼接在orderby后边
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getOrderByColumn() {
|
||||
if (!StringUtil.isNotEmpty(orderByColumn)) {
|
||||
return "";
|
||||
}
|
||||
return orderByColumn + " " + isAsc;
|
||||
}
|
||||
|
||||
public void setOrderByColumn(String orderByColumn) {
|
||||
this.orderByColumn = orderByColumn;
|
||||
}
|
||||
|
||||
public String getIsAsc() {
|
||||
return isAsc;
|
||||
}
|
||||
|
||||
public void setIsAsc(String isAsc) {
|
||||
if (StringUtil.isNotEmpty(isAsc)) {
|
||||
this.isAsc = isAsc;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.rabbiter.cm.common.utils;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class PathUtils {
|
||||
public static String getClassLoadRootPath() {
|
||||
String path = "";
|
||||
try {
|
||||
String prePath = URLDecoder.decode(PathUtils.class.getClassLoader().getResource("").getPath(),"utf-8").replace("/target/classes", "");
|
||||
String osName = System.getProperty("os.name");
|
||||
if (osName.toLowerCase().startsWith("mac")) {
|
||||
// 苹果
|
||||
path = prePath.substring(0, prePath.length() - 1);
|
||||
} else if (osName.toLowerCase().startsWith("windows")) {
|
||||
// windows
|
||||
path = prePath.substring(1, prePath.length() - 1);
|
||||
} else if(osName.toLowerCase().startsWith("linux") || osName.toLowerCase().startsWith("unix")) {
|
||||
// unix or linux
|
||||
path = prePath.substring(0, prePath.length() - 1);
|
||||
} else {
|
||||
path = prePath.substring(1, prePath.length() - 1);
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package com.rabbiter.cm.common.utils;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* 生成随机盐工具类
|
||||
*/
|
||||
public class SaltUtils {
|
||||
|
||||
public static String getSalt(int n) {
|
||||
//返回长度为n的随机盐
|
||||
StringBuilder sb = new StringBuilder();
|
||||
char[] chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()".toCharArray();
|
||||
for (int i = 0; i < n; i++) {
|
||||
char c = chars[new Random().nextInt(chars.length)];
|
||||
sb.append(c);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getSalt(8));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.rabbiter.cm.common.utils;
|
||||
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
/**
|
||||
* 从当前绑定的线程上获取请求属性
|
||||
*/
|
||||
public class ServletUtil {
|
||||
|
||||
/**
|
||||
* 获取所有请求属性
|
||||
*
|
||||
* @return 请求属性
|
||||
*/
|
||||
public static ServletRequestAttributes getAttributes() {
|
||||
return (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取request请求对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HttpServletRequest getRequest() {
|
||||
return getAttributes().getRequest();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取response响应对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HttpServletResponse getResponse() {
|
||||
return getAttributes().getResponse();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取session域对象
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HttpSession getSession() {
|
||||
return getRequest().getSession();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.rabbiter.cm.common.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description:
|
||||
* @author:
|
||||
* @create: 2024-06-02 15:59
|
||||
*/
|
||||
public class SessionSeatsUtil {
|
||||
/**
|
||||
* @param curSessionSeats
|
||||
* @param selectSeats
|
||||
* @return
|
||||
*/
|
||||
public static String changeSessionSeats(String curSessionSeats, String selectSeats) {
|
||||
JSONObject curSessionSeatsJSON = JSONObject.parseObject(curSessionSeats);
|
||||
// 超时订单已选座位
|
||||
Map<String, Integer> selectedSeatsMap = new LinkedHashMap<>();
|
||||
// 获取当前超时订单座位信息
|
||||
String[] selectedSeats = selectSeats.split(",");
|
||||
for (int i = 0; i < selectedSeats.length; i++) {
|
||||
String row = selectedSeats[i].substring(selectedSeats[i].indexOf("\"") + 1, selectedSeats[i].indexOf("排"));
|
||||
Integer col = Integer.parseInt(selectedSeats[i].substring(selectedSeats[i].indexOf("排") + 1, selectedSeats[i].indexOf("座")));
|
||||
selectedSeatsMap.put(row, col);
|
||||
}
|
||||
// 显示已选座位坐标
|
||||
selectedSeatsMap.forEach((key, value) -> {
|
||||
System.out.println("key = " + key + " value=" + value);
|
||||
});
|
||||
|
||||
|
||||
Map<String, Object> valueMap = new LinkedHashMap<>();
|
||||
valueMap.putAll(curSessionSeatsJSON);
|
||||
valueMap.forEach((key, value) -> System.out.println("\"" + key + "\":" + " " + value));
|
||||
// 取消选座
|
||||
selectedSeatsMap.forEach((index, value) -> {
|
||||
((JSONArray) valueMap.get(index)).set(value - 1, 0);
|
||||
});
|
||||
JSONObject newSessionSeatsJSON = new JSONObject(valueMap);
|
||||
return JSONObject.toJSONString(newSessionSeatsJSON);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
package com.rabbiter.cm.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 当前登录用户
|
||||
*/
|
||||
public class LoginUser implements Serializable {
|
||||
//登录的用户信息
|
||||
private SysUser sysUser;
|
||||
//用户管理的影院id
|
||||
private Long cinemaId;
|
||||
//用户管理的影院名称
|
||||
private String cinemaName;
|
||||
|
||||
//系统颁发的token
|
||||
private String token;
|
||||
|
||||
public LoginUser() {
|
||||
}
|
||||
|
||||
public LoginUser(SysUser sysUser, Long cinemaId, String cinemaName, String token) {
|
||||
this.sysUser = sysUser;
|
||||
this.cinemaId = cinemaId;
|
||||
this.cinemaName = cinemaName;
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoginUser{" +
|
||||
"sysUser=" + sysUser +
|
||||
", cinemaId=" + cinemaId +
|
||||
", cinemaName='" + cinemaName + '\'' +
|
||||
", token='" + token + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
LoginUser loginUser = (LoginUser) o;
|
||||
return Objects.equals(sysUser, loginUser.sysUser) && Objects.equals(cinemaId, loginUser.cinemaId) && Objects.equals(cinemaName, loginUser.cinemaName) && Objects.equals(token, loginUser.token);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sysUser, cinemaId, cinemaName, token);
|
||||
}
|
||||
|
||||
public SysUser getSysUser() {
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
public void setSysUser(SysUser sysUser) {
|
||||
this.sysUser = sysUser;
|
||||
}
|
||||
|
||||
public Long getCinemaId() {
|
||||
return cinemaId;
|
||||
}
|
||||
|
||||
public void setCinemaId(Long cinemaId) {
|
||||
this.cinemaId = cinemaId;
|
||||
}
|
||||
|
||||
public String getCinemaName() {
|
||||
return cinemaName;
|
||||
}
|
||||
|
||||
public void setCinemaName(String cinemaName) {
|
||||
this.cinemaName = cinemaName;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
package com.rabbiter.cm.domain;
|
||||
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SysMovie implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long movieId;
|
||||
|
||||
//电影名称
|
||||
@NotBlank(message = "电影名称不能为空")
|
||||
private String movieName;
|
||||
|
||||
//电影时长
|
||||
private Integer movieLength;
|
||||
|
||||
//电影海报
|
||||
private String moviePoster;
|
||||
|
||||
private String movieArea;
|
||||
|
||||
//上映日期
|
||||
private Date releaseDate;
|
||||
|
||||
//电影总票房
|
||||
private Double movieBoxOffice;
|
||||
|
||||
//电影简介
|
||||
private String movieIntroduction;
|
||||
|
||||
//电影图集
|
||||
private String moviePictures;
|
||||
|
||||
//电影的类别
|
||||
private List<SysMovieCategory> movieCategoryList;
|
||||
|
||||
public SysMovie() {
|
||||
}
|
||||
|
||||
public SysMovie(Long movieId, String movieName, Integer movieLength, String moviePoster, String movieArea, Date releaseDate, Double movieBoxOffice, String movieIntroduction, String moviePictures, List<SysMovieCategory> movieCategoryList) {
|
||||
this.movieId = movieId;
|
||||
this.movieName = movieName;
|
||||
this.movieLength = movieLength;
|
||||
this.moviePoster = moviePoster;
|
||||
this.movieArea = movieArea;
|
||||
this.releaseDate = releaseDate;
|
||||
this.movieBoxOffice = movieBoxOffice;
|
||||
this.movieIntroduction = movieIntroduction;
|
||||
this.moviePictures = moviePictures;
|
||||
this.movieCategoryList = movieCategoryList;
|
||||
}
|
||||
|
||||
public Long getMovieId() {
|
||||
return movieId;
|
||||
}
|
||||
|
||||
public void setMovieId(Long movieId) {
|
||||
this.movieId = movieId;
|
||||
}
|
||||
|
||||
public String getMovieName() {
|
||||
return movieName;
|
||||
}
|
||||
|
||||
public void setMovieName(String movieName) {
|
||||
this.movieName = movieName;
|
||||
}
|
||||
|
||||
public Integer getMovieLength() {
|
||||
return movieLength;
|
||||
}
|
||||
|
||||
public void setMovieLength(Integer movieLength) {
|
||||
this.movieLength = movieLength;
|
||||
}
|
||||
|
||||
public String getMoviePoster() {
|
||||
return moviePoster;
|
||||
}
|
||||
|
||||
public void setMoviePoster(String moviePoster) {
|
||||
this.moviePoster = moviePoster;
|
||||
}
|
||||
|
||||
public String getMovieArea() {
|
||||
return movieArea;
|
||||
}
|
||||
|
||||
public void setMovieArea(String movieArea) {
|
||||
this.movieArea = movieArea;
|
||||
}
|
||||
|
||||
public Date getReleaseDate() {
|
||||
return releaseDate;
|
||||
}
|
||||
|
||||
public void setReleaseDate(Date releaseDate) {
|
||||
this.releaseDate = releaseDate;
|
||||
}
|
||||
|
||||
public Double getMovieBoxOffice() {
|
||||
return movieBoxOffice;
|
||||
}
|
||||
|
||||
public void setMovieBoxOffice(Double movieBoxOffice) {
|
||||
this.movieBoxOffice = movieBoxOffice;
|
||||
}
|
||||
|
||||
public String getMovieIntroduction() {
|
||||
return movieIntroduction;
|
||||
}
|
||||
|
||||
public void setMovieIntroduction(String movieIntroduction) {
|
||||
this.movieIntroduction = movieIntroduction;
|
||||
}
|
||||
|
||||
public String getMoviePictures() {
|
||||
return moviePictures;
|
||||
}
|
||||
|
||||
public void setMoviePictures(String moviePictures) {
|
||||
this.moviePictures = moviePictures;
|
||||
}
|
||||
|
||||
public List<SysMovieCategory> getMovieCategoryList() {
|
||||
return movieCategoryList;
|
||||
}
|
||||
|
||||
public void setMovieCategoryList(List<SysMovieCategory> movieCategoryList) {
|
||||
this.movieCategoryList = movieCategoryList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SysMovie sysMovie = (SysMovie) o;
|
||||
return Objects.equals(movieId, sysMovie.movieId) && Objects.equals(movieName, sysMovie.movieName) && Objects.equals(movieLength, sysMovie.movieLength) && Objects.equals(moviePoster, sysMovie.moviePoster) && Objects.equals(movieArea, sysMovie.movieArea) && Objects.equals(releaseDate, sysMovie.releaseDate) && Objects.equals(movieBoxOffice, sysMovie.movieBoxOffice) && Objects.equals(movieIntroduction, sysMovie.movieIntroduction) && Objects.equals(moviePictures, sysMovie.moviePictures) && Objects.equals(movieCategoryList, sysMovie.movieCategoryList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(movieId, movieName, movieLength, moviePoster, movieArea, releaseDate, movieBoxOffice, movieIntroduction, moviePictures, movieCategoryList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysMovie{" +
|
||||
"movieId=" + movieId +
|
||||
", movieName='" + movieName + '\'' +
|
||||
", movieLength=" + movieLength +
|
||||
", moviePoster='" + moviePoster + '\'' +
|
||||
", movieArea='" + movieArea + '\'' +
|
||||
", releaseDate=" + releaseDate +
|
||||
", movieBoxOffice=" + movieBoxOffice +
|
||||
", movieIntroduction='" + movieIntroduction + '\'' +
|
||||
", moviePictures='" + moviePictures + '\'' +
|
||||
", movieCategoryList=" + movieCategoryList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.rabbiter.cm.domain;
|
||||
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SysMovieCategory implements Serializable {
|
||||
//序列号
|
||||
private static final long serialVersionUID = 1L;
|
||||
//电影分类id
|
||||
private Long movieCategoryId;
|
||||
//电影分类名称
|
||||
@NotBlank(message = "电影分类名称不能为空")
|
||||
private String movieCategoryName;
|
||||
|
||||
public SysMovieCategory() {
|
||||
}
|
||||
|
||||
public SysMovieCategory(Long movieCategoryId, String movieCategoryName) {
|
||||
this.movieCategoryId = movieCategoryId;
|
||||
this.movieCategoryName = movieCategoryName;
|
||||
}
|
||||
|
||||
public Long getMovieCategoryId() {
|
||||
return movieCategoryId;
|
||||
}
|
||||
|
||||
public void setMovieCategoryId(Long movieCategoryId) {
|
||||
this.movieCategoryId = movieCategoryId;
|
||||
}
|
||||
|
||||
public String getMovieCategoryName() {
|
||||
return movieCategoryName;
|
||||
}
|
||||
|
||||
public void setMovieCategoryName(String movieCategoryName) {
|
||||
this.movieCategoryName = movieCategoryName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SysMovieCategory that = (SysMovieCategory) o;
|
||||
return Objects.equals(movieCategoryId, that.movieCategoryId) && Objects.equals(movieCategoryName, that.movieCategoryName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(movieCategoryId, movieCategoryName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysMovieCategory{" +
|
||||
"movieCategoryId=" + movieCategoryId +
|
||||
", movieCategoryName='" + movieCategoryName + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.rabbiter.cm.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 存储电影与电影类别的多对多联系
|
||||
*/
|
||||
public class SysMovieToCategory implements Serializable {
|
||||
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
private Long movieId;
|
||||
|
||||
private Long movieCategoryId;
|
||||
|
||||
|
||||
public SysMovieToCategory() {
|
||||
}
|
||||
|
||||
public SysMovieToCategory(Long movieId, Long movieCategoryId) {
|
||||
this.movieId = movieId;
|
||||
this.movieCategoryId = movieCategoryId;
|
||||
}
|
||||
|
||||
public Long getMovieId() {
|
||||
return movieId;
|
||||
}
|
||||
|
||||
public void setMovieId(Long movieId) {
|
||||
this.movieId = movieId;
|
||||
}
|
||||
|
||||
public Long getMovieCategoryId() {
|
||||
return movieCategoryId;
|
||||
}
|
||||
|
||||
public void setMovieCategoryId(Long movieCategoryId) {
|
||||
this.movieCategoryId = movieCategoryId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SysMovieToCategory that = (SysMovieToCategory) o;
|
||||
return Objects.equals(movieId, that.movieId) && Objects.equals(movieCategoryId, that.movieCategoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(movieId, movieCategoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysMovieToCategory{" +
|
||||
"movieId=" + movieId +
|
||||
", movieCategoryId=" + movieCategoryId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,124 @@
|
||||
package com.rabbiter.cm.domain;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class SysResource implements Serializable {
|
||||
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
private String name;
|
||||
|
||||
private String path;
|
||||
|
||||
//菜单权限等级
|
||||
private Integer level;
|
||||
|
||||
private Long parentId;
|
||||
|
||||
//父菜单
|
||||
private SysResource parent;
|
||||
|
||||
//子菜单
|
||||
private List<SysResource> children;
|
||||
|
||||
public SysResource() {
|
||||
}
|
||||
|
||||
public SysResource(Long id, String name, String path, Integer level, Long parentId, SysResource parent, List<SysResource> children) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.path = path;
|
||||
this.level = level;
|
||||
this.parentId = parentId;
|
||||
this.parent = parent;
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public SysResource getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(SysResource parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List<SysResource> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SysResource> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SysResource that = (SysResource) o;
|
||||
return Objects.equals(id, that.id) && Objects.equals(name, that.name) && Objects.equals(path, that.path) && Objects.equals(level, that.level) && Objects.equals(parentId, that.parentId) && Objects.equals(parent, that.parent) && Objects.equals(children, that.children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, name, path, level, parentId, parent, children);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysResource{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", path='" + path + '\'' +
|
||||
", level=" + level +
|
||||
", parentId=" + parentId +
|
||||
", parent=" + parent +
|
||||
", children=" + children +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,243 @@
|
||||
package com.rabbiter.cm.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 场次实体类
|
||||
*/
|
||||
public class SysSession implements Serializable {
|
||||
|
||||
private static final Long serialVersionUID = 1L;
|
||||
|
||||
//场次编号
|
||||
private Long sessionId;
|
||||
|
||||
//影厅编号
|
||||
@NotNull(message = "场次所在影厅不能为空")
|
||||
private Long hallId;
|
||||
|
||||
//该场次语言版本
|
||||
@NotBlank(message = "场次电影语言版本不能为空")
|
||||
private String languageVersion;
|
||||
|
||||
// 电影编号
|
||||
@NotNull(message = "场次安排电影不能为空")
|
||||
private Long movieId;
|
||||
|
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "HH:mm")
|
||||
private String playTime;
|
||||
|
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "HH:mm")
|
||||
private String endTime;
|
||||
|
||||
// 截止时间,此时间之前不可删不可改电影、影厅信息
|
||||
private String deadline;
|
||||
|
||||
// 场次日期
|
||||
@NotNull(message = "场次日期不能为空")
|
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private LocalDate sessionDate;
|
||||
|
||||
// 场次票价
|
||||
@NotNull(message = "场次票价不能为空")
|
||||
@Size(min = 0, message = "场次票价不能为负数")
|
||||
private Double sessionPrice;
|
||||
|
||||
// 场次提示
|
||||
private String sessionTips;
|
||||
|
||||
// 场次座位信息
|
||||
@NotBlank(message = "场次座位信息不能为空")
|
||||
private String sessionSeats;
|
||||
|
||||
private Integer seatNums;
|
||||
|
||||
// 已售座位数
|
||||
private Integer sallNums;
|
||||
|
||||
private SysHall sysHall;
|
||||
|
||||
private SysMovie sysMovie;
|
||||
|
||||
public SysSession() {
|
||||
}
|
||||
|
||||
public SysSession(Long sessionId, Long hallId, String languageVersion, Long movieId, String playTime, String endTime, String deadline, LocalDate sessionDate, Double sessionPrice, String sessionTips, String sessionSeats, Integer seatNums, Integer sallNums, SysHall sysHall, SysMovie sysMovie) {
|
||||
this.sessionId = sessionId;
|
||||
this.hallId = hallId;
|
||||
this.languageVersion = languageVersion;
|
||||
this.movieId = movieId;
|
||||
this.playTime = playTime;
|
||||
this.endTime = endTime;
|
||||
this.deadline = deadline;
|
||||
this.sessionDate = sessionDate;
|
||||
this.sessionPrice = sessionPrice;
|
||||
this.sessionTips = sessionTips;
|
||||
this.sessionSeats = sessionSeats;
|
||||
this.seatNums = seatNums;
|
||||
this.sallNums = sallNums;
|
||||
this.sysHall = sysHall;
|
||||
this.sysMovie = sysMovie;
|
||||
}
|
||||
|
||||
public Long getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public Long getHallId() {
|
||||
return hallId;
|
||||
}
|
||||
|
||||
public void setHallId(Long hallId) {
|
||||
this.hallId = hallId;
|
||||
}
|
||||
|
||||
public String getLanguageVersion() {
|
||||
return languageVersion;
|
||||
}
|
||||
|
||||
public void setLanguageVersion(String languageVersion) {
|
||||
this.languageVersion = languageVersion;
|
||||
}
|
||||
|
||||
public Long getMovieId() {
|
||||
return movieId;
|
||||
}
|
||||
|
||||
public void setMovieId(Long movieId) {
|
||||
this.movieId = movieId;
|
||||
}
|
||||
|
||||
public String getPlayTime() {
|
||||
return playTime;
|
||||
}
|
||||
|
||||
public void setPlayTime(String playTime) {
|
||||
this.playTime = playTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getDeadline() {
|
||||
return deadline;
|
||||
}
|
||||
|
||||
public void setDeadline(String deadline) {
|
||||
this.deadline = deadline;
|
||||
}
|
||||
|
||||
public LocalDate getSessionDate() {
|
||||
return sessionDate;
|
||||
}
|
||||
|
||||
public void setSessionDate(LocalDate sessionDate) {
|
||||
this.sessionDate = sessionDate;
|
||||
}
|
||||
|
||||
public Double getSessionPrice() {
|
||||
return sessionPrice;
|
||||
}
|
||||
|
||||
public void setSessionPrice(Double sessionPrice) {
|
||||
this.sessionPrice = sessionPrice;
|
||||
}
|
||||
|
||||
public String getSessionTips() {
|
||||
return sessionTips;
|
||||
}
|
||||
|
||||
public void setSessionTips(String sessionTips) {
|
||||
this.sessionTips = sessionTips;
|
||||
}
|
||||
|
||||
public String getSessionSeats() {
|
||||
return sessionSeats;
|
||||
}
|
||||
|
||||
public void setSessionSeats(String sessionSeats) {
|
||||
this.sessionSeats = sessionSeats;
|
||||
}
|
||||
|
||||
public Integer getSeatNums() {
|
||||
return seatNums;
|
||||
}
|
||||
|
||||
public void setSeatNums(Integer seatNums) {
|
||||
this.seatNums = seatNums;
|
||||
}
|
||||
|
||||
public Integer getSallNums() {
|
||||
return sallNums;
|
||||
}
|
||||
|
||||
public void setSallNums(Integer sallNums) {
|
||||
this.sallNums = sallNums;
|
||||
}
|
||||
|
||||
public SysHall getSysHall() {
|
||||
return sysHall;
|
||||
}
|
||||
|
||||
public void setSysHall(SysHall sysHall) {
|
||||
this.sysHall = sysHall;
|
||||
}
|
||||
|
||||
public SysMovie getSysMovie() {
|
||||
return sysMovie;
|
||||
}
|
||||
|
||||
public void setSysMovie(SysMovie sysMovie) {
|
||||
this.sysMovie = sysMovie;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SysSession that = (SysSession) o;
|
||||
return Objects.equals(sessionId, that.sessionId) && Objects.equals(hallId, that.hallId) && Objects.equals(languageVersion, that.languageVersion) && Objects.equals(movieId, that.movieId) && Objects.equals(playTime, that.playTime) && Objects.equals(endTime, that.endTime) && Objects.equals(deadline, that.deadline) && Objects.equals(sessionDate, that.sessionDate) && Objects.equals(sessionPrice, that.sessionPrice) && Objects.equals(sessionTips, that.sessionTips) && Objects.equals(sessionSeats, that.sessionSeats) && Objects.equals(seatNums, that.seatNums) && Objects.equals(sallNums, that.sallNums) && Objects.equals(sysHall, that.sysHall) && Objects.equals(sysMovie, that.sysMovie);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(sessionId, hallId, languageVersion, movieId, playTime, endTime, deadline, sessionDate, sessionPrice, sessionTips, sessionSeats, seatNums, sallNums, sysHall, sysMovie);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysSession{" +
|
||||
"sessionId=" + sessionId +
|
||||
", hallId=" + hallId +
|
||||
", languageVersion='" + languageVersion + '\'' +
|
||||
", movieId=" + movieId +
|
||||
", playTime='" + playTime + '\'' +
|
||||
", endTime='" + endTime + '\'' +
|
||||
", deadline='" + deadline + '\'' +
|
||||
", sessionDate=" + sessionDate +
|
||||
", sessionPrice=" + sessionPrice +
|
||||
", sessionTips='" + sessionTips + '\'' +
|
||||
", sessionSeats='" + sessionSeats + '\'' +
|
||||
", seatNums=" + seatNums +
|
||||
", sallNums=" + sallNums +
|
||||
", sysHall=" + sysHall +
|
||||
", sysMovie=" + sysMovie +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.rabbiter.cm.domain.vo;
|
||||
|
||||
import com.rabbiter.cm.domain.SysBill;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 接收前端增加订单的数据
|
||||
*/
|
||||
public class SysBillVo implements Serializable {
|
||||
|
||||
//订单信息
|
||||
private SysBill sysBill;
|
||||
|
||||
//若成功更新后场次的座位信息
|
||||
private String sessionSeats;
|
||||
|
||||
public SysBillVo() {
|
||||
}
|
||||
|
||||
public SysBillVo(SysBill sysBill, String sessionSeats) {
|
||||
this.sysBill = sysBill;
|
||||
this.sessionSeats = sessionSeats;
|
||||
}
|
||||
|
||||
public SysBill getSysBill() {
|
||||
return sysBill;
|
||||
}
|
||||
|
||||
public void setSysBill(SysBill sysBill) {
|
||||
this.sysBill = sysBill;
|
||||
}
|
||||
|
||||
public String getSessionSeats() {
|
||||
return sessionSeats;
|
||||
}
|
||||
|
||||
public void setSessionSeats(String sessionSeats) {
|
||||
this.sessionSeats = sessionSeats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysBillVo{" +
|
||||
"sysBill=" + sysBill +
|
||||
", sessionSeats='" + sessionSeats + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.rabbiter.cm.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 封装电影查询的条件
|
||||
*/
|
||||
public class SysMovieVo implements Serializable {
|
||||
|
||||
private String movieName;
|
||||
|
||||
private String movieArea;
|
||||
|
||||
private Long movieCategoryId;
|
||||
|
||||
private Date startDate;
|
||||
|
||||
private Date endDate;
|
||||
|
||||
public SysMovieVo() {
|
||||
}
|
||||
|
||||
public SysMovieVo(String movieName, String movieArea, Long movieCategoryId, Date startDate, Date endDate) {
|
||||
this.movieName = movieName;
|
||||
this.movieArea = movieArea;
|
||||
this.movieCategoryId = movieCategoryId;
|
||||
this.startDate = startDate;
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getMovieName() {
|
||||
return movieName;
|
||||
}
|
||||
|
||||
public void setMovieName(String movieName) {
|
||||
this.movieName = movieName;
|
||||
}
|
||||
|
||||
public String getMovieArea() {
|
||||
return movieArea;
|
||||
}
|
||||
|
||||
public void setMovieArea(String movieArea) {
|
||||
this.movieArea = movieArea;
|
||||
}
|
||||
|
||||
public Long getMovieCategoryId() {
|
||||
return movieCategoryId;
|
||||
}
|
||||
|
||||
public void setMovieCategoryId(Long movieCategoryId) {
|
||||
this.movieCategoryId = movieCategoryId;
|
||||
}
|
||||
|
||||
public Date getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(Date startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public Date getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(Date endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
SysMovieVo that = (SysMovieVo) o;
|
||||
return Objects.equals(movieName, that.movieName) && Objects.equals(movieArea, that.movieArea) && Objects.equals(movieCategoryId, that.movieCategoryId) && Objects.equals(startDate, that.startDate) && Objects.equals(endDate, that.endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(movieName, movieArea, movieCategoryId, startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysMovieVo{" +
|
||||
"movieName='" + movieName + '\'' +
|
||||
", movieArea='" + movieArea + '\'' +
|
||||
", movieCategoryId=" + movieCategoryId +
|
||||
", startDate=" + startDate +
|
||||
", endDate=" + endDate +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.rabbiter.cm.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class SysSessionVo implements Serializable {
|
||||
|
||||
private Long hallId;
|
||||
|
||||
private Long movieId;
|
||||
|
||||
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
private LocalDate sessionDate;
|
||||
|
||||
public SysSessionVo() {
|
||||
}
|
||||
|
||||
public SysSessionVo(Long hallId, Long movieId, LocalDate sessionDate) {
|
||||
this.hallId = hallId;
|
||||
this.movieId = movieId;
|
||||
this.sessionDate = sessionDate;
|
||||
}
|
||||
|
||||
public Long getHallId() {
|
||||
return hallId;
|
||||
}
|
||||
|
||||
public void setHallId(Long hallId) {
|
||||
this.hallId = hallId;
|
||||
}
|
||||
|
||||
public Long getMovieId() {
|
||||
return movieId;
|
||||
}
|
||||
|
||||
public void setMovieId(Long movieId) {
|
||||
this.movieId = movieId;
|
||||
}
|
||||
|
||||
public LocalDate getSessionDate() {
|
||||
return sessionDate;
|
||||
}
|
||||
|
||||
public void setSessionDate(LocalDate sessionDate) {
|
||||
this.sessionDate = sessionDate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysSessionVo{" +
|
||||
"hallId=" + hallId +
|
||||
", movieId=" + movieId +
|
||||
", sessionDate=" + sessionDate +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package com.rabbiter.cm.domain.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 封装用户登录输入的信息
|
||||
*/
|
||||
public class SysUserVo implements Serializable {
|
||||
|
||||
private String userName;
|
||||
|
||||
private String password;
|
||||
|
||||
public SysUserVo() {
|
||||
}
|
||||
|
||||
public SysUserVo(String userName, String password) {
|
||||
this.userName = userName;
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUserVo{" +
|
||||
"userName='" + userName + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -1,21 +1,22 @@
|
||||
package com.rabbiter.cm.service;
|
||||
package com.rabbiter.cm.mapper;
|
||||
|
||||
import com.rabbiter.cm.domain.SysBill;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SysBillService {
|
||||
@Mapper
|
||||
public interface SysBillMapper {
|
||||
|
||||
List<SysBill> findAllBills(SysBill sysBill);
|
||||
|
||||
SysBill findBillById(Long id);
|
||||
|
||||
Object addBill(SysBill sysBill);
|
||||
int addBill(SysBill sysBill);
|
||||
|
||||
int updateBill(SysBill sysBill);
|
||||
|
||||
int deleteBill(Long[] ids);
|
||||
int deleteBill(Long id);
|
||||
|
||||
List<SysBill> findTimeoutBill();
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.rabbiter.cm.mapper;
|
||||
|
||||
import com.rabbiter.cm.domain.SysCinema;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysCinemaMapper {
|
||||
|
||||
SysCinema findCinema();
|
||||
|
||||
int updateCinema(SysCinema sysCinema);
|
||||
|
||||
// 前台展示单个影院信息,返回包含影院、上映中的所有电影信息
|
||||
SysCinema findCinemaById(Long id);
|
||||
|
||||
}
|
||||
@ -1,25 +1,28 @@
|
||||
package com.rabbiter.cm.service;
|
||||
package com.rabbiter.cm.mapper;
|
||||
|
||||
import com.rabbiter.cm.domain.SysMovieCategory;
|
||||
import com.rabbiter.cm.domain.SysMovieToCategory;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysMovieCategoryMapper {
|
||||
|
||||
public interface SysMovieCategoryService {
|
||||
List<SysMovieCategory> findAllCategorys();
|
||||
|
||||
SysMovieCategory findCategoryById(Long id);
|
||||
|
||||
List<SysMovieCategory> findOneMovieCategorys(Long id);
|
||||
|
||||
int addCategory(SysMovieCategory sysMovieCategory);
|
||||
|
||||
int updateCategory(SysMovieCategory sysMovieCategory);
|
||||
|
||||
int deleteCategory(Long[] ids);
|
||||
int deleteCategory(Long id);
|
||||
|
||||
int addMovieToCategory(SysMovieToCategory sysMovieToCategory);
|
||||
|
||||
int deleteMovieToCategory(SysMovieToCategory sysMovieToCategory);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.rabbiter.cm.mapper;
|
||||
|
||||
import com.rabbiter.cm.domain.SysResource;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysResourceMapper {
|
||||
|
||||
/**
|
||||
* 查询所有并包含其父菜单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SysResource> findAllResources();
|
||||
|
||||
/**
|
||||
* 查出所有菜单并包含其直接children
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SysResource> findWithChildren();
|
||||
|
||||
/**
|
||||
* 查询所有按父子关系的权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SysResource> findAllWithAllChildren();
|
||||
|
||||
SysResource findResourceById(Long id);
|
||||
|
||||
int addResource(SysResource sysResource);
|
||||
|
||||
int updateResource(SysResource sysResource);
|
||||
|
||||
int deleteResource(Long id);
|
||||
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.rabbiter.cm.mapper;
|
||||
|
||||
import com.rabbiter.cm.domain.SysRole;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SysRoleMapper {
|
||||
|
||||
List<SysRole> findAllRoles();
|
||||
|
||||
SysRole findRoleById(Long id);
|
||||
|
||||
int addRole(SysRole sysRole);
|
||||
|
||||
int updateRole(SysRole sysRole);
|
||||
|
||||
int deleteRole(Long id);
|
||||
|
||||
//给当前角色分配权限
|
||||
int addRight(Long roleId, Long resourceId);
|
||||
|
||||
int deleteRight(Long roleId, Long resourceId);
|
||||
|
||||
//查询指定角色的所有三级权限id
|
||||
List<Long> findAllRights(Long roleId);
|
||||
|
||||
}
|
||||
@ -1,28 +1,38 @@
|
||||
package com.rabbiter.cm.service;
|
||||
package com.rabbiter.cm.mapper;
|
||||
|
||||
import com.rabbiter.cm.domain.vo.SysUserVo;
|
||||
import com.rabbiter.cm.domain.LoginUser;
|
||||
import com.rabbiter.cm.domain.SysUser;
|
||||
import com.rabbiter.cm.domain.vo.SysUserVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SysUserService {
|
||||
@Mapper
|
||||
public interface SysUserMapper {
|
||||
List<SysUser> findAllUsers(SysUser sysUser);
|
||||
|
||||
SysUser findUserById(Long id);
|
||||
|
||||
/**
|
||||
* jwt校验
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
SysUser findUserByName(String userName);
|
||||
|
||||
int addUser(SysUser sysUser);
|
||||
|
||||
int updateUser(SysUser sysUser);
|
||||
|
||||
int deleteUser(Long[] ids);
|
||||
|
||||
LoginUser login(SysUserVo sysUserVo);
|
||||
int deleteUser(Long id);
|
||||
|
||||
LoginUser findLoginUser(SysUserVo sysUserVo);
|
||||
|
||||
boolean isUserNameUnique(String userName, Long userId);
|
||||
/**
|
||||
* 查出指定名字用户的所有id
|
||||
*
|
||||
* @param userName
|
||||
* @return
|
||||
*/
|
||||
List<Long> checkUserNameUnique(String userName);
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package com.rabbiter.cm.service;
|
||||
|
||||
import com.rabbiter.cm.domain.SysCinema;
|
||||
|
||||
|
||||
public interface SysCinemaService {
|
||||
|
||||
SysCinema findCinema();
|
||||
|
||||
int updateCinema(SysCinema sysCinema);
|
||||
|
||||
SysCinema findCinemaById(Long id);
|
||||
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package com.rabbiter.cm.service;
|
||||
|
||||
import com.rabbiter.cm.domain.SysMovie;
|
||||
import com.rabbiter.cm.domain.vo.SysMovieVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SysMovieService {
|
||||
|
||||
List<SysMovie> findAllMovies(SysMovieVo sysMovieVo);
|
||||
|
||||
SysMovie findMovieById(Long id);
|
||||
|
||||
SysMovie findOneMovie(Long id);
|
||||
|
||||
int addMovie(SysMovie sysMovie);
|
||||
|
||||
int updateMovie(SysMovie sysMovie);
|
||||
|
||||
int deleteMovie(Long[] ids);
|
||||
|
||||
//获取单个影院上映的所有电影信息
|
||||
// List<SysMovie> findByCinemaId(Long id);
|
||||
|
||||
|
||||
//获取各种榜单
|
||||
List<SysMovie> totalBoxOfficeList();
|
||||
|
||||
List<SysMovie> domesticBoxOfficeList();
|
||||
|
||||
List<SysMovie> foreignBoxOfficeList();
|
||||
|
||||
}
|
||||
@ -1,22 +0,0 @@
|
||||
package com.rabbiter.cm.service;
|
||||
|
||||
import com.rabbiter.cm.domain.SysResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SysResourceService {
|
||||
List<SysResource> findAllResources();
|
||||
|
||||
List<SysResource> findWithChildren();
|
||||
|
||||
List<SysResource> findAllWithAllChildren();
|
||||
|
||||
SysResource findResourceById(Long id);
|
||||
|
||||
int addResource(SysResource sysResource);
|
||||
|
||||
int updateResource(SysResource sysResource);
|
||||
|
||||
int deleteResource(Long[] ids);
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package com.rabbiter.cm.service;
|
||||
|
||||
import com.rabbiter.cm.domain.SysRole;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SysRoleService {
|
||||
List<SysRole> findAllRoles();
|
||||
|
||||
SysRole findRoleById(Long id);
|
||||
|
||||
int addRole(SysRole sysRole);
|
||||
|
||||
int updateRole(SysRole sysRole);
|
||||
|
||||
int deleteRole(Long[] ids);
|
||||
|
||||
int allotRight(Long roleId, Long[] resourceIds);
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
package com.rabbiter.cm.service;
|
||||
|
||||
import com.rabbiter.cm.domain.SysSession;
|
||||
import com.rabbiter.cm.domain.vo.SysSessionVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public interface SysSessionService {
|
||||
|
||||
List<SysSession> findByVo(SysSessionVo sysSessionVo);
|
||||
|
||||
List<SysSession> findSessionByMovieIdOrHallId(SysSession sysSession);
|
||||
|
||||
SysSession findSessionById(Long id);
|
||||
|
||||
SysSession findOneSession(Long id);
|
||||
|
||||
int addSession(SysSession sysSession);
|
||||
|
||||
int updateSession(SysSession sysSession);
|
||||
|
||||
int deleteSession(Long[] id);
|
||||
|
||||
List<SysSession> findSessionByMovieId(Long movieId);
|
||||
|
||||
}
|
||||
@ -1,53 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysBill;
|
||||
import com.rabbiter.cm.mapper.SysBillMapper;
|
||||
import com.rabbiter.cm.service.SysBillService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysBillServiceImpl implements SysBillService {
|
||||
|
||||
@Autowired
|
||||
private SysBillMapper sysBillMapper;
|
||||
|
||||
@Override
|
||||
public List<SysBill> findAllBills(SysBill sysBill) {
|
||||
return sysBillMapper.findAllBills(sysBill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysBill findBillById(Long id) {
|
||||
return sysBillMapper.findBillById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object addBill(SysBill sysBill) {
|
||||
int rows = sysBillMapper.addBill(sysBill);
|
||||
return rows > 0 ? sysBill : rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateBill(SysBill sysBill) {
|
||||
return sysBillMapper.updateBill(sysBill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteBill(Long[] ids) {
|
||||
int rows = 0;
|
||||
for (Long id : ids) {
|
||||
rows += sysBillMapper.deleteBill(id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysBill> findTimeoutBill() {
|
||||
return sysBillMapper.findTimeoutBill();
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysCinema;
|
||||
import com.rabbiter.cm.mapper.SysCinemaMapper;
|
||||
import com.rabbiter.cm.service.SysCinemaService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysCinemaServiceImpl implements SysCinemaService {
|
||||
|
||||
@Autowired
|
||||
private SysCinemaMapper sysCinemaMapper;
|
||||
|
||||
@Override
|
||||
public SysCinema findCinema() {
|
||||
return sysCinemaMapper.findCinema();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCinema(SysCinema sysCinema) {
|
||||
return sysCinemaMapper.updateCinema(sysCinema);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysCinema findCinemaById(Long id) {
|
||||
return sysCinemaMapper.findCinemaById(id);
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysHall;
|
||||
import com.rabbiter.cm.mapper.SysHallMapper;
|
||||
import com.rabbiter.cm.service.SysHallService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysHallServiceImpl implements SysHallService {
|
||||
|
||||
@Autowired
|
||||
private SysHallMapper sysHallMapper;
|
||||
|
||||
@Override
|
||||
public List<SysHall> findAllHalls(SysHall sysHall) {
|
||||
return sysHallMapper.findAllHalls(sysHall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysHall findHallById(SysHall sysHall) {
|
||||
return sysHallMapper.findHallById(sysHall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addHall(SysHall sysHall) {
|
||||
return sysHallMapper.addHall(sysHall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateHall(SysHall sysHall) {
|
||||
return sysHallMapper.updateHall(sysHall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteHall(SysHall[] sysHalls) {
|
||||
int rows = 0;
|
||||
for (SysHall sysHall : sysHalls) {
|
||||
rows += sysHallMapper.deleteHall(sysHall);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@ -1,59 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysMovieCategory;
|
||||
import com.rabbiter.cm.domain.SysMovieToCategory;
|
||||
import com.rabbiter.cm.mapper.SysMovieCategoryMapper;
|
||||
import com.rabbiter.cm.service.SysMovieCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysMovieCategoryServiceImpl implements SysMovieCategoryService {
|
||||
|
||||
@Autowired
|
||||
private SysMovieCategoryMapper sysMovieCategoryMapper;
|
||||
|
||||
@Override
|
||||
public List<SysMovieCategory> findAllCategorys() {
|
||||
return sysMovieCategoryMapper.findAllCategorys();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysMovieCategory findCategoryById(Long id) {
|
||||
return sysMovieCategoryMapper.findCategoryById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addCategory(SysMovieCategory sysMovieCategory) {
|
||||
return sysMovieCategoryMapper.addCategory(sysMovieCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateCategory(SysMovieCategory sysMovieCategory) {
|
||||
return sysMovieCategoryMapper.updateCategory(sysMovieCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteCategory(Long[] ids) {
|
||||
int rows = 0;
|
||||
for (Long id : ids) {
|
||||
rows += sysMovieCategoryMapper.deleteCategory(id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int addMovieToCategory(SysMovieToCategory sysMovieToCategory) {
|
||||
return sysMovieCategoryMapper.addMovieToCategory(sysMovieToCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteMovieToCategory(SysMovieToCategory sysMovieToCategory) {
|
||||
return sysMovieCategoryMapper.deleteMovieToCategory(sysMovieToCategory);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,77 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysResource;
|
||||
import com.rabbiter.cm.mapper.SysResourceMapper;
|
||||
import com.rabbiter.cm.service.SysResourceService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysResourceServiceImpl implements SysResourceService {
|
||||
|
||||
Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
@Autowired
|
||||
private SysResourceMapper sysResourceMapper;
|
||||
|
||||
@Override
|
||||
public List<SysResource> findAllResources() {
|
||||
return sysResourceMapper.findAllResources();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysResource> findWithChildren() {
|
||||
return sysResourceMapper.findWithChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysResource> findAllWithAllChildren() {
|
||||
return sysResourceMapper.findAllWithAllChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysResource findResourceById(Long id) {
|
||||
return sysResourceMapper.findResourceById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addResource(SysResource sysResource) {
|
||||
if (sysResource.getParentId() == 0) {
|
||||
sysResource.setLevel(1);
|
||||
} else {
|
||||
SysResource parent = this.findResourceById(sysResource.getParentId());
|
||||
if (parent != null) {
|
||||
sysResource.setLevel(parent.getLevel() + 1);
|
||||
}
|
||||
}
|
||||
return sysResourceMapper.addResource(sysResource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateResource(SysResource sysResource) {
|
||||
if (sysResource.getParentId() == 0) {
|
||||
sysResource.setLevel(1);
|
||||
} else {
|
||||
SysResource parent = this.findResourceById(sysResource.getParentId());
|
||||
if (parent != null) {
|
||||
sysResource.setLevel(parent.getLevel() + 1);
|
||||
}
|
||||
}
|
||||
log.debug(sysResource.toString());
|
||||
return sysResourceMapper.updateResource(sysResource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteResource(Long[] ids) {
|
||||
int rows = 0;
|
||||
for (Long id : ids) {
|
||||
rows += sysResourceMapper.deleteResource(id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysRole;
|
||||
import com.rabbiter.cm.mapper.SysRoleMapper;
|
||||
import com.rabbiter.cm.service.SysRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysRoleServiceImpl implements SysRoleService {
|
||||
|
||||
@Autowired
|
||||
private SysRoleMapper sysRoleMapper;
|
||||
|
||||
@Override
|
||||
public List<SysRole> findAllRoles() {
|
||||
return sysRoleMapper.findAllRoles();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysRole findRoleById(Long id) {
|
||||
return sysRoleMapper.findRoleById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addRole(SysRole sysRole) {
|
||||
return sysRoleMapper.addRole(sysRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateRole(SysRole sysRole) {
|
||||
return sysRoleMapper.updateRole(sysRole);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteRole(Long[] ids) {
|
||||
int rows = 0;
|
||||
for (Long id : ids) {
|
||||
rows += sysRoleMapper.deleteRole(id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int allotRight(Long roleId, Long[] keys) {
|
||||
int rows = 0;
|
||||
HashSet<Long> originResources = new HashSet<>(sysRoleMapper.findAllRights(roleId));
|
||||
|
||||
for (Long id : keys) {
|
||||
if (originResources.contains(id)) {
|
||||
originResources.remove(id);
|
||||
} else {
|
||||
rows += sysRoleMapper.addRight(roleId, id);
|
||||
}
|
||||
}
|
||||
for (Long id : originResources) {
|
||||
rows += sysRoleMapper.deleteRight(roleId, id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
package com.rabbiter.cm.service.impl;
|
||||
|
||||
import com.rabbiter.cm.domain.SysSession;
|
||||
import com.rabbiter.cm.domain.vo.SysSessionVo;
|
||||
import com.rabbiter.cm.mapper.SysSessionMapper;
|
||||
import com.rabbiter.cm.service.SysSessionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class SysSessionServiceImpl implements SysSessionService {
|
||||
|
||||
@Autowired
|
||||
private SysSessionMapper sysSessionMapper;
|
||||
|
||||
@Override
|
||||
public List<SysSession> findByVo(SysSessionVo sysSessionVo) {
|
||||
return sysSessionMapper.findByVo(sysSessionVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysSession> findSessionByMovieIdOrHallId(SysSession sysSession) {
|
||||
return sysSessionMapper.findSessionByMovieIdOrHallId(sysSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysSession findSessionById(Long id) {
|
||||
return sysSessionMapper.findSessionById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysSession findOneSession(Long id) {
|
||||
return sysSessionMapper.findOneSession(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addSession(SysSession sysSession) {
|
||||
return sysSessionMapper.addSession(sysSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateSession(SysSession sysSession) {
|
||||
return sysSessionMapper.updateSession(sysSession);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteSession(Long[] ids) {
|
||||
int rows = 0;
|
||||
for (Long id : ids) {
|
||||
rows += sysSessionMapper.deleteSession(id);
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysSession> findSessionByMovieId(Long movieId) {
|
||||
return sysSessionMapper.findSessionByMovieId(movieId);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue