feat: 重新设置代码格式
This commit is contained in:
parent
74fafe91a6
commit
77bf47834c
|
@ -40,6 +40,11 @@
|
|||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
</dependency>
|
||||
<!-- redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<!--支持配置属性类,yml文件中可以提示配置项-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package com.sky.common.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class AddResourceConfiguration extends WebMvcConfigurationSupport {
|
||||
/**
|
||||
* 设置静态资源映射
|
||||
*
|
||||
* @param registry ResourceHandlerRegistry
|
||||
*/
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
log.info("设置静态资源映射");
|
||||
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
}
|
|
@ -24,6 +24,8 @@ public class Knife4jConfiguration {
|
|||
*/
|
||||
@Bean
|
||||
public Docket docketAdmin() {
|
||||
log.info("A管理端接口");
|
||||
|
||||
// 添加作者
|
||||
Contact contact = new Contact("Bunny", "1319900154@qq.com", "1319900154@qq.com");
|
||||
// API文档
|
||||
|
@ -35,6 +37,8 @@ public class Knife4jConfiguration {
|
|||
|
||||
@Bean
|
||||
public Docket docketUser() {
|
||||
log.info("B用户端接口");
|
||||
|
||||
ApiInfo apiInfo = new ApiInfoBuilder().title("苍穹外卖项目接口文档").version("2.0").description("苍穹外卖项目接口文档").build();
|
||||
return new Docket(DocumentationType.SWAGGER_2).groupName("B用户端接口")
|
||||
.apiInfo(apiInfo).select().apis(RequestHandlerSelectors.basePackage("com.sky.controller.user"))
|
||||
|
@ -43,6 +47,8 @@ public class Knife4jConfiguration {
|
|||
|
||||
@Bean
|
||||
public Docket docketNotify() {
|
||||
log.info("Pay支付接口");
|
||||
|
||||
ApiInfo apiInfo = new ApiInfoBuilder().title("苍穹外卖项目接口文档").version("2.0").description("苍穹外卖项目接口文档").build();
|
||||
return new Docket(DocumentationType.SWAGGER_2).groupName("Pay支付接口")
|
||||
.apiInfo(apiInfo).select().apis(RequestHandlerSelectors.basePackage("com.sky.controller.notify"))
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
package com.sky.common.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
@Slf4j
|
||||
public class RestTemplateConfiguration {
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
log.info("注入restTemplate");
|
||||
return new RestTemplate();
|
||||
}
|
||||
}
|
|
@ -3,24 +3,22 @@ package com.sky.common.config;
|
|||
import com.sky.common.interceptor.JwtTokenAdminInterceptor;
|
||||
import com.sky.common.interceptor.JwtTokenUserInterceptor;
|
||||
import com.sky.common.json.JacksonObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
@Autowired
|
||||
JwtTokenAdminInterceptor jwtTokenAdminInterceptor;
|
||||
@Autowired
|
||||
JwtTokenUserInterceptor jwtTokenUserInterceptor;
|
||||
private final JwtTokenAdminInterceptor jwtTokenAdminInterceptor;
|
||||
private final JwtTokenUserInterceptor jwtTokenUserInterceptor;
|
||||
|
||||
/**
|
||||
* 注册自定义拦截器
|
||||
|
@ -52,15 +50,4 @@ public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
|||
// 将自己的消息转化器加入容器中
|
||||
converters.add(0, converter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置静态资源映射
|
||||
*
|
||||
* @param registry ResourceHandlerRegistry
|
||||
*/
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
log.info("设置静态资源映射");
|
||||
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 账号被锁定异常
|
||||
*/
|
||||
public class AccountLockedException extends BaseException{
|
||||
@Slf4j
|
||||
public class AccountLockedException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class AccountLockedException extends BaseException{
|
|||
|
||||
public AccountLockedException(String message) {
|
||||
super(message);
|
||||
log.error("账号被锁定异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 账号不存在异常
|
||||
*/
|
||||
public class AccountNotFoundException extends BaseException{
|
||||
@Slf4j
|
||||
public class AccountNotFoundException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class AccountNotFoundException extends BaseException{
|
|||
|
||||
public AccountNotFoundException(String message) {
|
||||
super(message);
|
||||
log.error("账号不存在异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 地址信息异常
|
||||
*/
|
||||
public class AddressBookBusinessException extends BaseException{
|
||||
@Slf4j
|
||||
public class AddressBookBusinessException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class AddressBookBusinessException extends BaseException{
|
|||
|
||||
public AddressBookBusinessException(String message) {
|
||||
super(message);
|
||||
log.error("账号不存在异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
public class BaseException extends RuntimeException{
|
||||
@Slf4j
|
||||
public class BaseException extends RuntimeException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -11,7 +14,9 @@ public class BaseException extends RuntimeException{
|
|||
*/
|
||||
public BaseException() {
|
||||
}
|
||||
|
||||
public BaseException(String message) {
|
||||
super(message);
|
||||
log.error("业务异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 不允许删除异常
|
||||
*/
|
||||
public class DeletionNotAllowedException extends BaseException{
|
||||
@Slf4j
|
||||
public class DeletionNotAllowedException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class DeletionNotAllowedException extends BaseException{
|
|||
|
||||
public DeletionNotAllowedException(String message) {
|
||||
super(message);
|
||||
log.error("不允许删除异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public class LoginFailedException extends BaseException{
|
||||
@Slf4j
|
||||
public class LoginFailedException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class LoginFailedException extends BaseException{
|
|||
|
||||
public LoginFailedException(String message) {
|
||||
super(message);
|
||||
log.error("登录失败:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 订单业务异常
|
||||
*/
|
||||
public class OrderBusinessException extends BaseException{
|
||||
@Slf4j
|
||||
public class OrderBusinessException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class OrderBusinessException extends BaseException{
|
|||
|
||||
public OrderBusinessException(String message) {
|
||||
super(message);
|
||||
log.error("订单业务异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 密码修改失败异常
|
||||
*/
|
||||
public class PasswordEditFailedException extends BaseException{
|
||||
@Slf4j
|
||||
public class PasswordEditFailedException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class PasswordEditFailedException extends BaseException{
|
|||
|
||||
public PasswordEditFailedException(String message) {
|
||||
super(message);
|
||||
log.error("密码修改失败异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 密码错误异常
|
||||
*/
|
||||
public class PasswordErrorException extends BaseException{
|
||||
@Slf4j
|
||||
public class PasswordErrorException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class PasswordErrorException extends BaseException{
|
|||
|
||||
public PasswordErrorException(String message) {
|
||||
super(message);
|
||||
log.error("密码错误异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,17 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* RestTemplateException异常
|
||||
*/
|
||||
@Slf4j
|
||||
public class RestTemplateException extends BaseException {
|
||||
public RestTemplateException() {
|
||||
}
|
||||
|
||||
public RestTemplateException(String message) {
|
||||
super(message);
|
||||
log.error("RestTemplateException异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 套餐启用失败异常
|
||||
*/
|
||||
public class SetMealEnableFailedException extends BaseException{
|
||||
@Slf4j
|
||||
public class SetMealEnableFailedException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class SetMealEnableFailedException extends BaseException{
|
|||
|
||||
public SetMealEnableFailedException(String message) {
|
||||
super(message);
|
||||
log.error("套餐启用失败异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 购物车异常
|
||||
*/
|
||||
public class ShoppingCartBusinessException extends BaseException{
|
||||
@Slf4j
|
||||
public class ShoppingCartBusinessException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
|
@ -14,5 +17,6 @@ public class ShoppingCartBusinessException extends BaseException{
|
|||
|
||||
public ShoppingCartBusinessException(String message) {
|
||||
super(message);
|
||||
log.error("购物车异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 用户未登录异常
|
||||
*/
|
||||
@Slf4j
|
||||
public class UserNotLoginException extends BaseException {
|
||||
/**
|
||||
* Constructs a new runtime exception with {@code null} as its
|
||||
|
@ -14,5 +17,6 @@ public class UserNotLoginException extends BaseException {
|
|||
|
||||
public UserNotLoginException(String message) {
|
||||
super(message);
|
||||
log.error("用户未登录异常:{}", message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@ public class GlobalExceptionHandler {
|
|||
|
||||
// 处理SQL异常
|
||||
public Result<String> exceptionHandler(SQLIntegrityConstraintViolationException exception) {
|
||||
log.error("处理SQL异常:{}", exception.getMessage());
|
||||
|
||||
String message = exception.getMessage();
|
||||
if (message.contains("Duplicate entry")) {
|
||||
String[] split = message.split(" ");
|
||||
String username = split[2];
|
||||
// 截取用户名
|
||||
String username = message.split(" ")[2];
|
||||
// 错误信息
|
||||
String errorMessage = username + MessageConstant.ALREADY_EXISTS;
|
||||
return Result.error(errorMessage);
|
||||
} else {
|
||||
|
|
|
@ -5,9 +5,9 @@ import com.sky.common.context.BaseContext;
|
|||
import com.sky.common.properties.JwtProperties;
|
||||
import com.sky.common.utils.JwtUtil;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
@ -19,12 +19,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
* 管理端用户判断
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class JwtTokenAdminInterceptor implements HandlerInterceptor {
|
||||
@Autowired
|
||||
JwtProperties jwtProperties;
|
||||
private final JwtProperties jwtProperties;
|
||||
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) throws Exception {
|
||||
public boolean preHandle(@NotNull HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) {
|
||||
// 判断当前兰街道的是Controller的方法还是其它资源
|
||||
if (!(handler instanceof HandlerMethod)) {
|
||||
// 拦截到的不是动态方法,直接放行
|
||||
|
@ -32,6 +32,7 @@ public class JwtTokenAdminInterceptor implements HandlerInterceptor {
|
|||
}
|
||||
// 1. 从请求头中获取令牌
|
||||
String token = request.getHeader(jwtProperties.getAdminTokenName());
|
||||
|
||||
// 2. 拦截令牌
|
||||
log.info("jwt校验:{}", token);
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.sky.common.properties.JwtProperties;
|
|||
import com.sky.common.utils.JwtUtil;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
@ -19,10 +19,10 @@ import javax.servlet.http.HttpServletResponse;
|
|||
* 客户端登录判断
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class JwtTokenUserInterceptor implements HandlerInterceptor {
|
||||
@Autowired
|
||||
JwtProperties jwtProperties;
|
||||
private final JwtProperties jwtProperties;
|
||||
|
||||
public boolean preHandle(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull Object handler) throws Exception {
|
||||
// 判断当前拦截到的是Controller方法还是其它资源
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.sky.common.json;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageResult implements Serializable {
|
||||
public class PageResult<T> implements Serializable {
|
||||
private long total; // 总记录数
|
||||
private List records; // 当前页数据集合
|
||||
private List<T> records; // 当前页数据集合
|
||||
}
|
||||
|
|
|
@ -29,10 +29,6 @@ public class HttpClientUtil {
|
|||
|
||||
/**
|
||||
* 发送GET方式请求
|
||||
*
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
public static String doGet(String url, Map<String, String> paramMap) {
|
||||
// 创建Httpclient对象
|
||||
|
@ -76,11 +72,6 @@ public class HttpClientUtil {
|
|||
|
||||
/**
|
||||
* 发送POST方式请求
|
||||
*
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> paramMap) throws IOException {
|
||||
// 创建Httpclient对象
|
||||
|
@ -124,11 +115,6 @@ public class HttpClientUtil {
|
|||
|
||||
/**
|
||||
* 发送POST方式请求
|
||||
*
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String doPost4Json(String url, Map<String, String> paramMap) throws IOException {
|
||||
// 创建Httpclient对象
|
||||
|
|
|
@ -8,8 +8,8 @@ public final class MD5 {
|
|||
|
||||
public static String encrypt(String strSrc) {
|
||||
try {
|
||||
char hexChars[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', 'a', 'b', 'c', 'd', 'e', 'f' };
|
||||
char[] hexChars = {'0', '1', '2', '3', '4', '5', '6', '7', '8',
|
||||
'9', 'a', 'b', 'c', 'd', 'e', 'f'};
|
||||
byte[] bytes = strSrc.getBytes();
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
md.update(bytes);
|
||||
|
@ -17,8 +17,7 @@ public final class MD5 {
|
|||
int j = bytes.length;
|
||||
char[] chars = new char[j * 2];
|
||||
int k = 0;
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
byte b = bytes[i];
|
||||
for (byte b : bytes) {
|
||||
chars[k++] = hexChars[b >>> 4 & 0xf];
|
||||
chars[k++] = hexChars[b & 0xf];
|
||||
}
|
||||
|
|
|
@ -3,20 +3,18 @@ package com.sky.common.utils;
|
|||
|
||||
import com.sky.common.properties.MinioProperties;
|
||||
import io.minio.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MinioUtils {
|
||||
@Resource
|
||||
private MinioClient minioClient;
|
||||
|
||||
@Resource
|
||||
private MinioProperties minioProperties;
|
||||
private final MinioClient minioClient;
|
||||
private final MinioProperties minioProperties;
|
||||
|
||||
/**
|
||||
* 判断桶是否存在
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.sky.common.utils;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class RedisUtil {
|
||||
private static final RedisTemplate<Object, Object> redisTemplate = new RedisTemplate<>();
|
||||
|
||||
public static void cleanCache(String key) {
|
||||
Set<Object> keys = redisTemplate.keys(key);
|
||||
if (keys != null) {
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
package com.sky.common.utils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.http.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -9,9 +9,9 @@ import org.springframework.web.client.RestTemplate;
|
|||
import java.io.Serializable;
|
||||
|
||||
@Component
|
||||
public class RestTemplateUtils<T> implements Serializable {
|
||||
@Autowired
|
||||
RestTemplate restTemplate;
|
||||
@RequiredArgsConstructor
|
||||
public class RestTemplateUtil<T> implements Serializable {
|
||||
private final RestTemplate restTemplate;
|
||||
|
||||
public ResponseEntity<?> requestGet(String url, T t) {
|
||||
HttpHeaders headers = new HttpHeaders();
|
|
@ -5,6 +5,7 @@ import com.sky.common.context.BaseContext;
|
|||
import com.sky.common.properties.WeChatProperties;
|
||||
import com.wechat.pay.contrib.apache.httpclient.WechatPayHttpClientBuilder;
|
||||
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.RandomStringUtils;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
|
@ -14,7 +15,6 @@ import org.apache.http.entity.ContentType;
|
|||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -33,16 +33,13 @@ import java.util.UUID;
|
|||
* 微信支付工具类
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class WeChatPayUtil {
|
||||
|
||||
// 微信支付下单接口地址
|
||||
public static final String JSAPI = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi";
|
||||
|
||||
// 申请退款接口地址
|
||||
public static final String REFUNDS = "https://api.mch.weixin.qq.com/v3/refund/domestic/refunds";
|
||||
|
||||
@Autowired
|
||||
private WeChatProperties weChatProperties;
|
||||
private final WeChatProperties weChatProperties;
|
||||
|
||||
/**
|
||||
* 获取调用微信接口的客户端工具对象
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CategoryDTO implements Serializable {
|
||||
|
||||
//主键
|
||||
// 主键
|
||||
private Long id;
|
||||
|
||||
//类型 1 菜品分类 2 套餐分类
|
||||
// 类型 1 菜品分类 2 套餐分类
|
||||
private Integer type;
|
||||
|
||||
//分类名称
|
||||
// 分类名称
|
||||
private String name;
|
||||
|
||||
//排序
|
||||
// 排序
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CategoryPageQueryDTO implements Serializable {
|
||||
|
||||
//页码
|
||||
// 页码
|
||||
private int page;
|
||||
|
||||
//每页记录数
|
||||
// 每页记录数
|
||||
private int pageSize;
|
||||
|
||||
//分类名称
|
||||
// 分类名称
|
||||
private String name;
|
||||
|
||||
//分类类型 1菜品分类 2套餐分类
|
||||
// 分类类型 1菜品分类 2套餐分类
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,6 @@ import java.time.LocalDateTime;
|
|||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataOverViewQueryDTO implements Serializable {
|
||||
|
||||
private LocalDateTime begin;
|
||||
|
||||
private LocalDateTime end;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import com.sky.pojo.entity.DishFlavor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -9,6 +11,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DishDTO implements Serializable {
|
||||
private Long id;
|
||||
// 菜品名称
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DishPageQueryDTO implements Serializable {
|
||||
|
||||
private int page;
|
||||
|
||||
private int pageSize;
|
||||
|
||||
private String name;
|
||||
|
||||
//分类id
|
||||
// 分类id
|
||||
private Integer categoryId;
|
||||
|
||||
//状态 0表示禁用 1表示启用
|
||||
// 状态 0表示禁用 1表示启用
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EmployeeDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String idNumber;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,15 @@ package com.sky.pojo.dto;
|
|||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ApiModel(description = "员工登录时传递的数据模型")
|
||||
public class EmployeeLoginDTO implements Serializable {
|
||||
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class EmployeePageQueryDTO implements Serializable {
|
||||
//员工姓名
|
||||
// 员工姓名
|
||||
private String name;
|
||||
//页码
|
||||
// 页码
|
||||
private int page;
|
||||
//每页显示记录数
|
||||
// 每页显示记录数
|
||||
private int pageSize;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrdersCancelDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
//订单取消原因
|
||||
// 订单取消原因
|
||||
private String cancelReason;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrdersConfirmDTO implements Serializable {
|
||||
private Long id;
|
||||
// 订单状态 1待付款 2待接单 3 已接单 4 派送中 5 已完成 6 已取消 7 退款
|
||||
|
|
|
@ -1,56 +1,45 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import com.sky.pojo.entity.OrderDetail;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrdersDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
//订单号
|
||||
// 订单号
|
||||
private String number;
|
||||
|
||||
//订单状态 1待付款,2待派送,3已派送,4已完成,5已取消
|
||||
// 订单状态 1待付款,2待派送,3已派送,4已完成,5已取消
|
||||
private Integer status;
|
||||
|
||||
//下单用户id
|
||||
// 下单用户id
|
||||
private Long userId;
|
||||
|
||||
//地址id
|
||||
// 地址id
|
||||
private Long addressBookId;
|
||||
|
||||
//下单时间
|
||||
// 下单时间
|
||||
private LocalDateTime orderTime;
|
||||
|
||||
//结账时间
|
||||
// 结账时间
|
||||
private LocalDateTime checkoutTime;
|
||||
|
||||
//支付方式 1微信,2支付宝
|
||||
// 支付方式 1微信,2支付宝
|
||||
private Integer payMethod;
|
||||
|
||||
//实收金额
|
||||
// 实收金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//备注
|
||||
// 备注
|
||||
private String remark;
|
||||
|
||||
//用户名
|
||||
// 用户名
|
||||
private String userName;
|
||||
|
||||
//手机号
|
||||
// 手机号
|
||||
private String phone;
|
||||
|
||||
//地址
|
||||
// 地址
|
||||
private String address;
|
||||
|
||||
//收货人
|
||||
// 收货人
|
||||
private String consignee;
|
||||
|
||||
private List<OrderDetail> orderDetails;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,30 +1,25 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrdersPageQueryDTO implements Serializable {
|
||||
|
||||
private int page;
|
||||
|
||||
private int pageSize;
|
||||
|
||||
private String number;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String phone;
|
||||
private Integer status;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime beginTime;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrdersPaymentDTO implements Serializable {
|
||||
// 订单号
|
||||
private String orderNumber;
|
||||
|
||||
// 付款方式
|
||||
private Integer payMethod;
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrdersRejectionDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
//订单拒绝原因
|
||||
// 订单拒绝原因
|
||||
private String rejectionReason;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,31 +1,35 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class OrdersSubmitDTO implements Serializable {
|
||||
//地址簿id
|
||||
// 地址簿id
|
||||
private Long addressBookId;
|
||||
//付款方式
|
||||
// 付款方式
|
||||
private int payMethod;
|
||||
//备注
|
||||
// 备注
|
||||
private String remark;
|
||||
//预计送达时间
|
||||
// 预计送达时间
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime estimatedDeliveryTime;
|
||||
//配送状态 1立即送出 0选择具体时间
|
||||
// 配送状态 1立即送出 0选择具体时间
|
||||
private Integer deliveryStatus;
|
||||
//餐具数量
|
||||
// 餐具数量
|
||||
private Integer tablewareNumber;
|
||||
//餐具数量状态 1按餐量提供 0选择具体数量
|
||||
// 餐具数量状态 1按餐量提供 0选择具体数量
|
||||
private Integer tablewareStatus;
|
||||
//打包费
|
||||
// 打包费
|
||||
private Integer packAmount;
|
||||
//总金额
|
||||
// 总金额
|
||||
private BigDecimal amount;
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PasswordEditDTO implements Serializable {
|
||||
|
||||
//员工id
|
||||
// 员工id
|
||||
private Long empId;
|
||||
|
||||
//旧密码
|
||||
// 旧密码
|
||||
private String oldPassword;
|
||||
|
||||
//新密码
|
||||
// 新密码
|
||||
private String newPassword;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import com.sky.pojo.entity.SetmealDish;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
@ -9,27 +11,22 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SetmealDTO implements Serializable {
|
||||
private Long id;
|
||||
|
||||
// 分类id
|
||||
private Long categoryId;
|
||||
|
||||
// 套餐名称
|
||||
private String name;
|
||||
|
||||
// 套餐价格
|
||||
private BigDecimal price;
|
||||
|
||||
// 状态 0:停用 1:启用
|
||||
private Integer status;
|
||||
|
||||
// 描述信息
|
||||
private String description;
|
||||
|
||||
// 图片
|
||||
private String image;
|
||||
|
||||
// 套餐菜品关系
|
||||
private List<SetmealDish> setmealDishes = new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class SetmealPageQueryDTO implements Serializable {
|
||||
|
||||
private int page;
|
||||
|
||||
private int pageSize;
|
||||
|
||||
private String name;
|
||||
|
||||
//分类id
|
||||
// 分类id
|
||||
private Integer categoryId;
|
||||
|
||||
//状态 0表示禁用 1表示启用
|
||||
// 状态 0表示禁用 1表示启用
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ShoppingCartDTO implements Serializable {
|
||||
private Long dishId;
|
||||
private Long setmealId;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -8,8 +10,8 @@ import java.io.Serializable;
|
|||
* C端用户登录
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserLoginDTO implements Serializable {
|
||||
|
||||
private String code;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
FROM openjdk:18
|
||||
|
||||
#系统编码
|
||||
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
|
||||
|
||||
# 设置时区,构建镜像时执行的命令
|
||||
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
|
||||
RUN echo "Asia/Shanghai" > /etc/timezone
|
||||
|
||||
# 设定工作目录
|
||||
WORKDIR /home/bunny
|
||||
|
||||
# 复制jar包
|
||||
COPY target/sky-server-1.0-SNAPSHOT.jar /home/bunny/app.jar
|
||||
|
||||
#启动容器时的进程
|
||||
ENTRYPOINT ["java","-jar","/home/bunny/app.jar"]
|
||||
|
||||
#暴露 8080 端口
|
||||
EXPOSE 8080
|
|
@ -1,5 +0,0 @@
|
|||
FROM openjdk:8-jdk-alpine
|
||||
|
||||
ADD *.jar app.jar
|
||||
|
||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/app.jar"]
|
|
@ -9,8 +9,8 @@ import com.sky.pojo.entity.Category;
|
|||
import com.sky.service.CategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -20,13 +20,12 @@ import java.util.List;
|
|||
* 分类管理
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/category")
|
||||
@Api(tags = "分类相关接口")
|
||||
@Slf4j
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增分类")
|
||||
|
@ -38,9 +37,9 @@ public class CategoryController {
|
|||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分类分页查询")
|
||||
public Result<PageResult> page(CategoryPageQueryDTO categoryPageQueryDTO) {
|
||||
public Result<PageResult<Category>> page(CategoryPageQueryDTO categoryPageQueryDTO) {
|
||||
log.info("分页查询:{}", categoryPageQueryDTO);
|
||||
PageResult pageResult = categoryService.pageQuery(categoryPageQueryDTO);
|
||||
PageResult<Category> pageResult = categoryService.pageQuery(categoryPageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.sky.common.result.Result;
|
|||
import com.sky.service.MinioService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -16,12 +16,12 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common")
|
||||
@Api(tags = "通用接口")
|
||||
@Slf4j
|
||||
public class CommonController {
|
||||
@Autowired
|
||||
private MinioService minioService;
|
||||
private final MinioService minioService;
|
||||
|
||||
@ApiOperation(value = "文件上传")
|
||||
@PostMapping("/upload")
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.sky.controller.admin;
|
|||
|
||||
import com.sky.common.result.PageResult;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.common.utils.RedisUtil;
|
||||
import com.sky.pojo.dto.DishDTO;
|
||||
import com.sky.pojo.dto.DishPageQueryDTO;
|
||||
import com.sky.pojo.entity.Dish;
|
||||
|
@ -10,49 +11,45 @@ import com.sky.pojo.vo.DishVO;
|
|||
import com.sky.service.DishService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/dish")
|
||||
@Api(tags = "菜品相关接口")
|
||||
@Slf4j
|
||||
public class DishController {
|
||||
@Autowired
|
||||
DishService dishService;
|
||||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
private final DishService dishService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增菜品")
|
||||
public Result save(@RequestBody DishDTO dishDTO) {
|
||||
public Result<DishDTO> save(@RequestBody DishDTO dishDTO) {
|
||||
log.info("新增菜品:{}", dishDTO);
|
||||
// 删除redis中缓存
|
||||
cleanCache("dish_" + dishDTO.getCategoryId());
|
||||
RedisUtil.cleanCache("dish_" + dishDTO.getCategoryId());
|
||||
dishService.saveWithFlavor(dishDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("菜品分页查询")
|
||||
public Result<PageResult> page(DishPageQueryDTO dishPageQueryDTO) {
|
||||
public Result<PageResult<DishVO>> page(DishPageQueryDTO dishPageQueryDTO) {
|
||||
log.info("菜品分页查询:{}", dishPageQueryDTO);
|
||||
PageResult pageResult = dishService.pageQuery(dishPageQueryDTO);
|
||||
PageResult<DishVO> pageResult = dishService.pageQuery(dishPageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("菜品批量删除")
|
||||
public Result delete(@RequestParam List<Long> ids) {
|
||||
public Result<String> delete(@RequestParam List<Long> ids) {
|
||||
log.info("菜品批量删除:{}", ids);
|
||||
dishService.deleteBatch(ids);
|
||||
// 将菜品数据删除
|
||||
cleanCache("dish_*");
|
||||
RedisUtil.cleanCache("dish_*");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
@ -66,36 +63,29 @@ public class DishController {
|
|||
|
||||
@PutMapping
|
||||
@ApiOperation("修改菜品")
|
||||
public Result update(@RequestBody DishDTO dto) {
|
||||
public Result<DishDTO> update(@RequestBody DishDTO dto) {
|
||||
log.info("修改菜品:{}", dto);
|
||||
dishService.updateWithFlavor(dto);
|
||||
// 将菜品数据删除
|
||||
cleanCache("dish_*");
|
||||
RedisUtil.cleanCache("dish_*");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("status/{status}")
|
||||
@ApiOperation("菜品起售、停售")
|
||||
public Result status(@PathVariable Integer status, Long id) {
|
||||
public Result<String> status(@PathVariable Integer status, Long id) {
|
||||
log.info("菜品起售、停售:{},菜品id:{}", status, id);
|
||||
dishService.updateWithStatus(status, id);
|
||||
// 将菜品数据删除
|
||||
cleanCache("dish_*");
|
||||
RedisUtil.cleanCache("dish_*");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("根据分类id查询菜品")
|
||||
public Result list(Long categoryId) {
|
||||
public Result<List<Dish>> list(Long categoryId) {
|
||||
log.info("根据分类id查询菜品:{}", categoryId);
|
||||
List<Dish> dishVOList = dishService.getByCategoryId(categoryId);
|
||||
return Result.success(dishVOList);
|
||||
}
|
||||
|
||||
private void cleanCache(String key) {
|
||||
Set keys = redisTemplate.keys(key);
|
||||
if (keys != null) {
|
||||
redisTemplate.delete(keys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ public class OrderController {
|
|||
|
||||
@GetMapping("/conditionSearch")
|
||||
@ApiOperation(value = "订单搜索")
|
||||
public Result<PageResult> conditionSearch(OrdersPageQueryDTO dto) {
|
||||
PageResult pageResult = orderService.conditionSearch(dto);
|
||||
public Result<PageResult<OrderVO>> conditionSearch(OrdersPageQueryDTO dto) {
|
||||
PageResult<OrderVO> pageResult = orderService.conditionSearch(dto);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
|
@ -49,35 +49,35 @@ public class OrderController {
|
|||
|
||||
@PutMapping("/confirm")
|
||||
@ApiOperation("接单")
|
||||
public Result confirm(@RequestBody OrdersConfirmDTO dto) {
|
||||
public Result<String> confirm(@RequestBody OrdersConfirmDTO dto) {
|
||||
orderService.confirm(dto);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/rejection")
|
||||
@ApiOperation("拒单")
|
||||
public Result rejection(@RequestBody OrdersRejectionDTO dto) {
|
||||
public Result<String> rejection(@RequestBody OrdersRejectionDTO dto) {
|
||||
orderService.rejection(dto);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/cancel")
|
||||
@ApiOperation("取消订单")
|
||||
public Result cancelBusiness(@RequestBody OrdersCancelDTO dto) throws Exception {
|
||||
public Result<String> cancelBusiness(@RequestBody OrdersCancelDTO dto) throws Exception {
|
||||
orderService.cancelBusiness(dto);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/delivery/{id}")
|
||||
@ApiOperation("派送订单")
|
||||
public Result delivery(@PathVariable("id") Long id) {
|
||||
public Result<String> delivery(@PathVariable("id") Long id) {
|
||||
orderService.delivery(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/complete/{id}")
|
||||
@ApiOperation("完成订单")
|
||||
public Result complete(@PathVariable("id") Long id) {
|
||||
public Result<String> complete(@PathVariable("id") Long id) {
|
||||
orderService.complete(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import com.sky.pojo.vo.UserReportVO;
|
|||
import com.sky.service.ReportService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -19,12 +19,12 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.time.LocalDate;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/report")
|
||||
@Slf4j
|
||||
@Api(tags = "统计报表相关接口")
|
||||
public class ReportController {
|
||||
@Autowired
|
||||
private ReportService reportService;
|
||||
private final ReportService reportService;
|
||||
|
||||
@GetMapping("/turnoverStatistics")
|
||||
@ApiOperation(value = "营业额数据统计")
|
||||
|
|
|
@ -25,15 +25,15 @@ public class SetMealController {
|
|||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页查询")
|
||||
public Result page(SetmealPageQueryDTO dto) {
|
||||
public Result<PageResult<SetmealVO>> page(SetmealPageQueryDTO dto) {
|
||||
log.info("分页查询:{}", dto);
|
||||
PageResult pageResult = setmealService.pageQuery(dto);
|
||||
PageResult<SetmealVO> pageResult = setmealService.pageQuery(dto);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("根据id查询套餐")
|
||||
public Result page4Id(@PathVariable Long id) {
|
||||
public Result<SetmealVO> page4Id(@PathVariable Long id) {
|
||||
log.info("根据id查询套餐:{}", id);
|
||||
SetmealVO setmealVO = setmealService.page4Id(id);
|
||||
return Result.success(setmealVO);
|
||||
|
@ -42,7 +42,7 @@ public class SetMealController {
|
|||
@PutMapping()
|
||||
@ApiOperation("修改套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache", allEntries = true)
|
||||
public Result update(@RequestBody SetmealDTO setmealDTO) {
|
||||
public Result<String> update(@RequestBody SetmealDTO setmealDTO) {
|
||||
log.info("修改套餐:{}", setmealDTO);
|
||||
setmealService.update(setmealDTO);
|
||||
return Result.success();
|
||||
|
@ -51,7 +51,7 @@ public class SetMealController {
|
|||
@PostMapping("")
|
||||
@ApiOperation("新增套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache", key = "#setmealDTO.categoryId")
|
||||
public Result setmeal(@RequestBody SetmealDTO setmealDTO) {
|
||||
public Result<String> setmeal(@RequestBody SetmealDTO setmealDTO) {
|
||||
log.info("新增套餐:{}", setmealDTO);
|
||||
setmealService.insert(setmealDTO);
|
||||
return Result.success();
|
||||
|
@ -60,7 +60,7 @@ public class SetMealController {
|
|||
@PostMapping("status/{status}")
|
||||
@ApiOperation("套餐起售、停售")
|
||||
@CacheEvict(cacheNames = "setmealCache", allEntries = true)
|
||||
public Result updateStatus(@PathVariable Integer status, Long id) {
|
||||
public Result<String> updateStatus(@PathVariable Integer status, Long id) {
|
||||
log.info("套餐起售、停售,状态:{},id:{}", status, id);
|
||||
setmealService.updateStatus(status, id);
|
||||
return Result.success();
|
||||
|
@ -69,7 +69,7 @@ public class SetMealController {
|
|||
@DeleteMapping("")
|
||||
@ApiOperation("批量删除套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache", allEntries = true)
|
||||
public Result delete(@RequestParam List<Long> ids) {
|
||||
public Result<String> delete(@RequestParam List<Long> ids) {
|
||||
log.info("批量删除套餐:{}", ids);
|
||||
setmealService.delete(ids);
|
||||
return Result.success();
|
||||
|
|
|
@ -4,23 +4,23 @@ import com.sky.common.constant.MessageConstant;
|
|||
import com.sky.common.result.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController("adminShopController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/shop")
|
||||
@Api(tags = "店铺相关接口")
|
||||
@Slf4j
|
||||
public class ShopController {
|
||||
public static final String KEY = "SHOP_STATUS";
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
private final RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
@PutMapping("/{status}")
|
||||
@ApiOperation("设置店铺的营业状态")
|
||||
public Result setStatus(@PathVariable Integer status) {
|
||||
public Result<String> setStatus(@PathVariable Integer status) {
|
||||
log.info("设置店铺的营业状态为:{}", status == 1 ? "营业中" : "打烊中");
|
||||
redisTemplate.opsForValue().set(KEY, status);
|
||||
return Result.success();
|
||||
|
|
|
@ -8,8 +8,8 @@ import com.sky.pojo.vo.SetmealOverViewVO;
|
|||
import com.sky.service.WorkspaceService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -21,19 +21,14 @@ import java.time.LocalTime;
|
|||
* 工作台
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/workspace")
|
||||
@Slf4j
|
||||
@Api(tags = "工作台相关接口")
|
||||
public class WorkSpaceController {
|
||||
|
||||
@Autowired
|
||||
private WorkspaceService workspaceService;
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
/**
|
||||
* 工作台今日数据查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/businessData")
|
||||
@ApiOperation("工作台今日数据查询")
|
||||
public Result<BusinessDataVO> businessData() {
|
||||
|
@ -46,33 +41,18 @@ public class WorkSpaceController {
|
|||
return Result.success(businessDataVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询订单管理数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/overviewOrders")
|
||||
@ApiOperation("查询订单管理数据")
|
||||
public Result<OrderOverViewVO> orderOverView() {
|
||||
return Result.success(workspaceService.getOrderOverView());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜品总览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/overviewDishes")
|
||||
@ApiOperation("查询菜品总览")
|
||||
public Result<DishOverViewVO> dishOverView() {
|
||||
return Result.success(workspaceService.getDishOverView());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询套餐总览
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/overviewSetmeals")
|
||||
@ApiOperation("查询套餐总览")
|
||||
public Result<SetmealOverViewVO> setmealOverView() {
|
||||
|
|
|
@ -7,9 +7,9 @@ import com.sky.common.properties.WeChatProperties;
|
|||
import com.sky.service.OrderService;
|
||||
import com.wechat.pay.contrib.apache.httpclient.util.AesUtil;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
@ -24,13 +24,12 @@ import java.util.UUID;
|
|||
* 支付回调相关接口
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/notify")
|
||||
@Slf4j
|
||||
public class PayNotifyController {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
@Autowired
|
||||
private WeChatProperties weChatProperties;
|
||||
private final OrderService orderService;
|
||||
private final WeChatProperties weChatProperties;
|
||||
|
||||
/**
|
||||
* 支付成功回调
|
||||
|
|
|
@ -6,18 +6,17 @@ import com.sky.pojo.entity.AddressBook;
|
|||
import com.sky.service.AddressBookService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/addressBook")
|
||||
@Api(tags = "C端地址簿接口")
|
||||
public class AddressBookController {
|
||||
|
||||
@Autowired
|
||||
private AddressBookService addressBookService;
|
||||
private final AddressBookService addressBookService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询当前登录用户的所有地址信息")
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.sky.pojo.entity.Category;
|
|||
import com.sky.service.CategoryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -13,12 +13,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import java.util.List;
|
||||
|
||||
@RestController("userCategoryController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/category")
|
||||
@Api(tags = "C端-分类接口")
|
||||
public class CategoryController {
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询分类")
|
||||
|
|
|
@ -8,8 +8,8 @@ import com.sky.pojo.vo.DishVO;
|
|||
import com.sky.service.DishService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -19,13 +19,12 @@ import java.util.List;
|
|||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController("userDishController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/dish")
|
||||
@Slf4j
|
||||
@Api(tags = "C端-菜品浏览接口")
|
||||
public class DishController {
|
||||
@Autowired
|
||||
RedisTemplate redisTemplate;
|
||||
@Autowired
|
||||
private final RedisTemplate<Object, Object> redisTemplate;
|
||||
DishService dishService;
|
||||
|
||||
@GetMapping("/list")
|
||||
|
|
|
@ -10,20 +10,20 @@ import com.sky.pojo.vo.OrderVO;
|
|||
import com.sky.service.OrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@RestController("userOrderController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/order")
|
||||
@Slf4j
|
||||
@Api(tags = "C端订单接口")
|
||||
public class OrderController {
|
||||
@Autowired
|
||||
private OrderService orderService;
|
||||
private final OrderService orderService;
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperation("用户下单")
|
||||
|
|
|
@ -7,7 +7,7 @@ import com.sky.pojo.vo.DishItemVO;
|
|||
import com.sky.service.SetmealService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
@ -17,11 +17,11 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import java.util.List;
|
||||
|
||||
@RestController("userSetmealController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/setmeal")
|
||||
@Api(tags = "C端-套餐浏览接口")
|
||||
public class SetmealController {
|
||||
@Autowired
|
||||
private SetmealService setmealService;
|
||||
private final SetmealService setmealService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("根据分类id查询套餐")
|
||||
|
|
|
@ -45,5 +45,4 @@ public interface AddressBookMapper {
|
|||
*/
|
||||
@Delete("delete from address_book where id = #{id}")
|
||||
void deleteById(Long id);
|
||||
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ public interface CategoryService {
|
|||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
PageResult pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);
|
||||
PageResult<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);
|
||||
|
||||
/**
|
||||
* 根据id删除分类
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface DishService {
|
|||
* @param dishPageQueryDTO 菜品分页查询-前端参数
|
||||
* @return 封装分页查询结果
|
||||
*/
|
||||
PageResult pageQuery(DishPageQueryDTO dishPageQueryDTO);
|
||||
PageResult<DishVO> pageQuery(DishPageQueryDTO dishPageQueryDTO);
|
||||
|
||||
/**
|
||||
* 菜品批量删除
|
||||
|
|
|
@ -86,7 +86,7 @@ public interface OrderService {
|
|||
* @param dto 订单详情
|
||||
* @return 分页数据
|
||||
*/
|
||||
PageResult conditionSearch(OrdersPageQueryDTO dto);
|
||||
PageResult<OrderVO> conditionSearch(OrdersPageQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 各个状态的订单数量统计
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface SetmealService {
|
|||
* @param dto 前端请求
|
||||
* @return PageResult
|
||||
*/
|
||||
PageResult pageQuery(SetmealPageQueryDTO dto);
|
||||
PageResult<SetmealVO> pageQuery(SetmealPageQueryDTO dto);
|
||||
|
||||
/**
|
||||
* 根据id查询套餐
|
||||
|
|
|
@ -14,9 +14,9 @@ import com.sky.pojo.dto.CategoryDTO;
|
|||
import com.sky.pojo.dto.CategoryPageQueryDTO;
|
||||
import com.sky.pojo.entity.Category;
|
||||
import com.sky.service.CategoryService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -26,14 +26,12 @@ import java.util.List;
|
|||
* 分类业务层
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CategoryServiceImpl implements CategoryService {
|
||||
@Autowired
|
||||
private CategoryMapper categoryMapper;
|
||||
@Autowired
|
||||
private DishMapper dishMapper;
|
||||
@Autowired
|
||||
private SetmealMapper setmealMapper;
|
||||
private final CategoryMapper categoryMapper;
|
||||
private final DishMapper dishMapper;
|
||||
private final SetmealMapper setmealMapper;
|
||||
|
||||
/**
|
||||
* 新增分类
|
||||
|
@ -42,21 +40,19 @@ public class CategoryServiceImpl implements CategoryService {
|
|||
Category category = new Category();
|
||||
// 属性拷贝
|
||||
BeanUtils.copyProperties(categoryDTO, category);
|
||||
|
||||
// 分类状态默认为禁用状态0
|
||||
category.setStatus(StatusConstant.DISABLE);
|
||||
|
||||
categoryMapper.insert(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
public PageResult pageQuery(CategoryPageQueryDTO categoryPageQueryDTO) {
|
||||
public PageResult<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO) {
|
||||
PageHelper.startPage(categoryPageQueryDTO.getPage(), categoryPageQueryDTO.getPageSize());
|
||||
// 下一条sql进行分页,自动加入limit关键字分页
|
||||
Page<Category> page = categoryMapper.pageQuery(categoryPageQueryDTO);
|
||||
return new PageResult(page.getTotal(), page.getResult());
|
||||
return new PageResult<>(page.getTotal(), page.getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,9 +17,9 @@ import com.sky.pojo.entity.DishFlavor;
|
|||
import com.sky.pojo.entity.Setmeal;
|
||||
import com.sky.pojo.vo.DishVO;
|
||||
import com.sky.service.DishService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -28,16 +28,13 @@ import java.util.List;
|
|||
import java.util.Objects;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DishServiceImpl implements DishService {
|
||||
@Autowired
|
||||
DishMapper dishMapper;
|
||||
@Autowired
|
||||
DishFlavorMapper dishFlavorMapper;
|
||||
@Autowired
|
||||
SetMealDishMapper setMealDishMapper;
|
||||
@Autowired
|
||||
SetmealMapper setmealMapper;
|
||||
private final DishMapper dishMapper;
|
||||
private final DishFlavorMapper dishFlavorMapper;
|
||||
private final SetMealDishMapper setMealDishMapper;
|
||||
private final SetmealMapper setmealMapper;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -70,10 +67,10 @@ public class DishServiceImpl implements DishService {
|
|||
* @return 封装分页查询结果
|
||||
*/
|
||||
@Override
|
||||
public PageResult pageQuery(DishPageQueryDTO dto) {
|
||||
public PageResult<DishVO> pageQuery(DishPageQueryDTO dto) {
|
||||
PageHelper.startPage(dto.getPage(), dto.getPageSize());
|
||||
Page<DishVO> page = dishMapper.pageQuery(dto);
|
||||
return new PageResult(page.getTotal(), page.getResult());
|
||||
return new PageResult<>(page.getTotal(), page.getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -174,7 +174,7 @@ public class OrderServiceImpl implements OrderService {
|
|||
|
||||
orderMapper.update(orders);
|
||||
// 通过客户端浏览器推送消息
|
||||
HashMap map = new HashMap<>();
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("type", 1);// 1 来单提醒 2 客户催单
|
||||
map.put("orderId", ordersDB.getId());
|
||||
map.put("content", "订单号" + outTradeNo);
|
||||
|
@ -199,7 +199,7 @@ public class OrderServiceImpl implements OrderService {
|
|||
ordersPageQueryDTO.setUserId(BaseContext.getUserId());
|
||||
// 分页条件查询
|
||||
Page<Orders> page = orderMapper.pageQuery(ordersPageQueryDTO);
|
||||
List<OrderVO> list = new ArrayList();
|
||||
List<OrderVO> list = new ArrayList<>();
|
||||
|
||||
// 查询出订单明细,并封装入OrderVO进行响应
|
||||
if (page != null && page.getTotal() > 0) {
|
||||
|
@ -216,7 +216,7 @@ public class OrderServiceImpl implements OrderService {
|
|||
list.add(orderVO);
|
||||
}
|
||||
}
|
||||
return new PageResult(page.getTotal(), list);
|
||||
return new PageResult<>(page.getTotal(), list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,12 +346,12 @@ public class OrderServiceImpl implements OrderService {
|
|||
* @return 分页数据
|
||||
*/
|
||||
@Override
|
||||
public PageResult conditionSearch(OrdersPageQueryDTO dto) {
|
||||
public PageResult<OrderVO> conditionSearch(OrdersPageQueryDTO dto) {
|
||||
PageHelper.startPage(dto.getPage(), dto.getPageSize());
|
||||
Page<Orders> page = orderMapper.pageQuery(dto);
|
||||
// 部分订单状态,需要额外返回订单菜品信息,将Orders转化为OrderVO
|
||||
List<OrderVO> orderVOList = orderServiceImplUtils.getOrderVOList(page);
|
||||
return new PageResult(page.getTotal(), orderVOList);
|
||||
return new PageResult<>(page.getTotal(), orderVOList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,13 +41,13 @@ public class SetmealServiceImpl implements SetmealService {
|
|||
* @return PageResult
|
||||
*/
|
||||
@Override
|
||||
public PageResult pageQuery(SetmealPageQueryDTO dto) {
|
||||
public PageResult<SetmealVO> pageQuery(SetmealPageQueryDTO dto) {
|
||||
int pageSize = dto.getPageSize();
|
||||
int page = dto.getPage();
|
||||
PageHelper.startPage(page, pageSize);
|
||||
|
||||
Page<SetmealVO> setmealVOPage = setmealMapper.pageQuery(dto);
|
||||
return new PageResult(setmealVOPage.getTotal(), setmealVOPage.getResult());
|
||||
return new PageResult<>(setmealVOPage.getTotal(), setmealVOPage.getResult());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
-----------------▄██-█▄---------
|
||||
-----------------███▄██▄--------
|
||||
-----------------███████--------
|
||||
-----------------▀███████-------
|
||||
-------------------██████▄▄-----
|
||||
-------------------█████████▄---
|
||||
-------------------██████▄████--
|
||||
-------▄███████████████████████-
|
||||
-----▄███████████████████████▀--
|
||||
---▄██████████████████████------
|
||||
---███████████████████████------
|
||||
---███████████████████████------
|
||||
-▄▄██████████████████████▀------
|
||||
-█████████████████▀█████--------
|
||||
-▀██████████████▀▀-▀█████▄------
|
||||
-------▀▀▀▀▀▀▀▀▀------▀▀▀▀------
|
|
@ -140,6 +140,7 @@
|
|||
from orders
|
||||
where id = #{id};
|
||||
</select>
|
||||
|
||||
<select id="countStatus" resultType="java.lang.Integer">
|
||||
select count(*)
|
||||
from orders
|
||||
|
|
Loading…
Reference in New Issue