init
This commit is contained in:
commit
d0f34716a6
|
@ -0,0 +1,6 @@
|
|||
**/target/
|
||||
.idea
|
||||
*.iml
|
||||
*.class
|
||||
*Test.java
|
||||
**/test/
|
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="sky-common" />
|
||||
<module name="sky-server" />
|
||||
<module name="sky-pojo" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="sky-common" options="-parameters" />
|
||||
<module name="sky-pojo" options="-parameters" />
|
||||
<module name="sky-server" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/sky-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/sky-pojo/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/sky-server/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="workspaceImportForciblyTurnedOn" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,139 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<version>2.7.3</version>
|
||||
</parent>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>dev-sky-serve-v1</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<modules>
|
||||
<module>sky-common</module>
|
||||
<module>sky-pojo</module>
|
||||
<module>sky-server</module>
|
||||
<module>sky-server</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<mybatis.spring>2.2.0</mybatis.spring>
|
||||
<lombok>1.18.20</lombok>
|
||||
<fastjson>1.2.76</fastjson>
|
||||
<commons.lang>2.6</commons.lang>
|
||||
<druid>1.2.1</druid>
|
||||
<pagehelper>1.3.0</pagehelper>
|
||||
<aliyun.sdk.oss>3.10.2</aliyun.sdk.oss>
|
||||
<knife4j>3.0.3</knife4j>
|
||||
<aspectj>1.9.4</aspectj>
|
||||
<jjwt>0.9.1</jjwt>
|
||||
<jaxb-api>2.3.1</jaxb-api>
|
||||
<poi>3.16</poi>
|
||||
<minio>8.4.3</minio>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>${mybatis.spring}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>${commons.lang}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
<version>${pagehelper}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>${aspectj}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
<version>${aspectj}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt</artifactId>
|
||||
<version>${jjwt}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.sdk.oss}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
<version>${jaxb-api}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
<version>${poi}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>${poi}</version>
|
||||
</dependency>
|
||||
<!--微信支付-->
|
||||
<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||
<version>0.4.8</version>
|
||||
</dependency>
|
||||
<!-- minio -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
<version>${minio}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
|
@ -0,0 +1,81 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>dev-sky-serve-v1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sky-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>sky-common</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<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>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
<!--微信支付-->
|
||||
<dependency>
|
||||
<groupId>com.github.wechatpay-apiv3</groupId>
|
||||
<artifactId>wechatpay-apache-httpclient</artifactId>
|
||||
</dependency>
|
||||
<!-- minio -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<!-- websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +1,11 @@
|
|||
package com.sky.common.constant;
|
||||
|
||||
/**
|
||||
* 公共字段自动填充相关常量
|
||||
*/
|
||||
public class AutoFillConstant {
|
||||
public static final String SET_CREATE_TIME = "setCreateTime";
|
||||
public static final String SET_UPDATE_TIME = "setUpdateTime";
|
||||
public static final String SET_CREATE_USER = "setCreateUser";
|
||||
public static final String SET_UPDATE_USER = "setUpdateUser";
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.sky.common.constant;
|
||||
|
||||
public class JwtClaimsConstant {
|
||||
public static final String EMP_ID = "empId";
|
||||
public static final String USER_ID = "userId";
|
||||
public static final String PHONE = "phone";
|
||||
public static final String USERNAME = "username";
|
||||
public static final String NAME = "name";
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.sky.common.constant;
|
||||
|
||||
/**
|
||||
* 信息提示常量类
|
||||
*/
|
||||
public class MessageConstant {
|
||||
public static final String PASSWORD_ERROR = "密码错误";
|
||||
public static final String OLD_PASSWORD_ERROR = "旧密码不匹配";
|
||||
public static final String OLD_PASSWORD_SAME_NEW_PASSWORD = "旧密码与新密码相同";
|
||||
public static final String ACCOUNT_NOT_FOUND = "账号不存在";
|
||||
public static final String ACCOUNT_LOCKED = "账号被锁定";
|
||||
public static final String UNKNOWN_ERROR = "未知错误";
|
||||
public static final String USER_NOT_LOGIN = "用户未登录";
|
||||
public static final String CATEGORY_BE_RELATED_BY_SETMEAL = "当前分类关联了套餐,不能删除";
|
||||
public static final String CATEGORY_BE_RELATED_BY_DISH = "当前分类关联了菜品,不能删除";
|
||||
public static final String SHOPPING_CART_IS_NULL = "购物车数据为空,不能下单";
|
||||
public static final String ADDRESS_BOOK_IS_NULL = "用户地址为空,不能下单";
|
||||
public static final String LOGIN_FAILED = "登录失败";
|
||||
public static final String UPLOAD_FAILED = "文件上传失败";
|
||||
public static final String SETMEAL_ENABLE_FAILED = "套餐内包含未启售菜品,无法启售";
|
||||
public static final String PASSWORD_EDIT_FAILED = "密码修改失败";
|
||||
public static final String DISH_ON_SALE = "起售中的菜品不能删除";
|
||||
public static final String SETMEAL_ON_SALE = "起售中的套餐不能删除";
|
||||
public static final String DISH_BE_RELATED_BY_SETMEAL = "当前菜品关联了套餐,不能删除";
|
||||
public static final String ORDER_STATUS_ERROR = "订单状态错误";
|
||||
public static final String ORDER_STATUS_NOT_OP = "订单已被接单或已制作";
|
||||
public static final String ORDER_NOT_FOUND = "订单不存在";
|
||||
public static final String ALREADY_EXISTS = "已存在";
|
||||
public static final String NOT_SET_STATUS = "请先设置营业状态";
|
||||
public static final String REQUEST_NOT_EMPTY = "请求不为空";
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.sky.common.constant;
|
||||
|
||||
/**
|
||||
* 密码常量
|
||||
*/
|
||||
public class PasswordConstant {
|
||||
// 默认密码
|
||||
public static final String DEFAULT_PASSWORD = "123456";
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.sky.common.constant;
|
||||
|
||||
/**
|
||||
* 状态常量,启用或者禁用
|
||||
*/
|
||||
public class StatusConstant {
|
||||
//启用为1
|
||||
public static final Integer ENABLE = 1;
|
||||
//禁用为0
|
||||
public static final Integer DISABLE = 0;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.sky.common.enumeration;
|
||||
|
||||
/**
|
||||
* 数据库操作类型
|
||||
* 使用AutoFill面向切面,设置枚举量
|
||||
*/
|
||||
public enum OperationType {
|
||||
UPDATE,// 更新操作
|
||||
INSERT// 插入操作
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 账号被锁定异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public AccountLockedException() {
|
||||
}
|
||||
|
||||
public AccountLockedException(String message) {
|
||||
super(message);
|
||||
log.error("账号被锁定异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 账号不存在异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public AccountNotFoundException() {
|
||||
}
|
||||
|
||||
public AccountNotFoundException(String message) {
|
||||
super(message);
|
||||
log.error("账号不存在异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 地址信息异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public AddressBookBusinessException() {
|
||||
}
|
||||
|
||||
public AddressBookBusinessException(String message) {
|
||||
super(message);
|
||||
log.error("账号不存在异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public BaseException() {
|
||||
}
|
||||
|
||||
public BaseException(String message) {
|
||||
super(message);
|
||||
log.error("业务异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 不允许删除异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public DeletionNotAllowedException() {
|
||||
}
|
||||
|
||||
public DeletionNotAllowedException(String message) {
|
||||
super(message);
|
||||
log.error("不允许删除异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public LoginFailedException() {
|
||||
}
|
||||
|
||||
public LoginFailedException(String message) {
|
||||
super(message);
|
||||
log.error("登录失败:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 订单业务异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public OrderBusinessException() {
|
||||
}
|
||||
|
||||
public OrderBusinessException(String message) {
|
||||
super(message);
|
||||
log.error("订单业务异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 密码修改失败异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public PasswordEditFailedException() {
|
||||
}
|
||||
|
||||
public PasswordEditFailedException(String message) {
|
||||
super(message);
|
||||
log.error("密码修改失败异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 密码错误异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public PasswordErrorException() {
|
||||
}
|
||||
|
||||
public PasswordErrorException(String message) {
|
||||
super(message);
|
||||
log.error("密码错误异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 套餐启用失败异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public SetMealEnableFailedException() {
|
||||
}
|
||||
|
||||
public SetMealEnableFailedException(String message) {
|
||||
super(message);
|
||||
log.error("套餐启用失败异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.exception;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 购物车异常
|
||||
*/
|
||||
@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
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public ShoppingCartBusinessException() {
|
||||
}
|
||||
|
||||
public ShoppingCartBusinessException(String message) {
|
||||
super(message);
|
||||
log.error("购物车异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
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
|
||||
* detail message. The cause is not initialized, and may subsequently be
|
||||
* initialized by a call to {@link #initCause}.
|
||||
*/
|
||||
public UserNotLoginException() {
|
||||
}
|
||||
|
||||
public UserNotLoginException(String message) {
|
||||
super(message);
|
||||
log.error("用户未登录异常:{}", message);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.sky.common.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sky.jwt")
|
||||
@Data
|
||||
public class JwtProperties {
|
||||
/**
|
||||
* 管理端员工生成jwt令牌相关配置
|
||||
*/
|
||||
private String adminSecretKey;
|
||||
private long adminTtl;
|
||||
private String adminTokenName;
|
||||
|
||||
/**
|
||||
* 用户端微信用户生成jwt令牌相关配置
|
||||
*/
|
||||
private String userSecretKey;
|
||||
private long userTtl;
|
||||
private String userTokenName;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.common.properties;
|
||||
|
||||
import io.minio.MinioClient;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sky.minio")
|
||||
@Data
|
||||
public class MinioProperties {
|
||||
private String endpointUrl;
|
||||
private String accessKey;
|
||||
private String secretKey;
|
||||
private String bucketName;
|
||||
|
||||
@Bean
|
||||
public MinioClient minioClient() {
|
||||
return MinioClient.builder().endpoint(endpointUrl).credentials(accessKey, secretKey).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.sky.common.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sky.wechat")
|
||||
@Data
|
||||
public class WeChatProperties {
|
||||
private String appid; // 小程序的appid
|
||||
private String secret; // 小程序的秘钥
|
||||
private String mchid; // 商户号
|
||||
private String mchSerialNo; // 商户API证书的证书序列号
|
||||
private String privateKeyFilePath; // 商户私钥文件
|
||||
private String apiV3Key; // 证书解密的密钥
|
||||
private String weChatPayCertFilePath; // 平台证书
|
||||
private String notifyUrl; // 支付成功的回调地址
|
||||
private String refundNotifyUrl; // 退款成功的回调地址
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>dev-sky-serve-v1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sky-pojo</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>sky-pojo</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
|
@ -0,0 +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 套餐分类
|
||||
private Integer type;
|
||||
// 分类名称
|
||||
private String name;
|
||||
// 排序
|
||||
private Integer sort;
|
||||
}
|
|
@ -0,0 +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套餐分类
|
||||
private Integer type;
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DataOverViewQueryDTO implements Serializable {
|
||||
private LocalDateTime begin;
|
||||
private LocalDateTime end;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
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;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class DishDTO implements Serializable {
|
||||
private Long id;
|
||||
// 菜品名称
|
||||
private String name;
|
||||
// 菜品分类id
|
||||
private Long categoryId;
|
||||
// 菜品价格
|
||||
private BigDecimal price;
|
||||
// 图片
|
||||
private String image;
|
||||
// 描述信息
|
||||
private String description;
|
||||
// 0 停售 1 起售
|
||||
private Integer status;
|
||||
// 口味
|
||||
private List<DishFlavor> flavors = new ArrayList<>();
|
||||
}
|
|
@ -0,0 +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
|
||||
private Integer categoryId;
|
||||
// 状态 0表示禁用 1表示启用
|
||||
private Integer status;
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
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 {
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class GoodsSalesDTO implements Serializable {
|
||||
//商品名称
|
||||
private String name;
|
||||
|
||||
//销量
|
||||
private Integer number;
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
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 退款
|
||||
private Integer status;
|
||||
}
|
|
@ -0,0 +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已取消
|
||||
private Integer status;
|
||||
// 下单用户id
|
||||
private Long userId;
|
||||
// 地址id
|
||||
private Long addressBookId;
|
||||
// 下单时间
|
||||
private LocalDateTime orderTime;
|
||||
// 结账时间
|
||||
private LocalDateTime checkoutTime;
|
||||
// 支付方式 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;
|
||||
}
|
|
@ -0,0 +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 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;
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
|
@ -0,0 +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;
|
||||
}
|
|
@ -0,0 +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
|
||||
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选择具体时间
|
||||
private Integer deliveryStatus;
|
||||
// 餐具数量
|
||||
private Integer tablewareNumber;
|
||||
// 餐具数量状态 1按餐量提供 0选择具体数量
|
||||
private Integer tablewareStatus;
|
||||
// 打包费
|
||||
private Integer packAmount;
|
||||
// 总金额
|
||||
private BigDecimal amount;
|
||||
}
|
|
@ -0,0 +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
|
||||
private Long empId;
|
||||
// 旧密码
|
||||
private String oldPassword;
|
||||
// 新密码
|
||||
private String newPassword;
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
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;
|
||||
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<>();
|
||||
}
|
|
@ -0,0 +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
|
||||
private Integer categoryId;
|
||||
// 状态 0表示禁用 1表示启用
|
||||
private Integer status;
|
||||
}
|
|
@ -0,0 +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 ShoppingCartDTO implements Serializable {
|
||||
private Long dishId;
|
||||
private Long setmealId;
|
||||
private String dishFlavor;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.sky.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* C端用户登录
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class UserLoginDTO implements Serializable {
|
||||
private String code;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 地址簿
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AddressBook implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//用户id
|
||||
private Long userId;
|
||||
|
||||
//收货人
|
||||
private String consignee;
|
||||
|
||||
//手机号
|
||||
private String phone;
|
||||
|
||||
//性别 0 女 1 男
|
||||
private String sex;
|
||||
|
||||
//省级区划编号
|
||||
private String provinceCode;
|
||||
|
||||
//省级名称
|
||||
private String provinceName;
|
||||
|
||||
//市级区划编号
|
||||
private String cityCode;
|
||||
|
||||
//市级名称
|
||||
private String cityName;
|
||||
|
||||
//区级区划编号
|
||||
private String districtCode;
|
||||
|
||||
//区级名称
|
||||
private String districtName;
|
||||
|
||||
//详细地址
|
||||
private String detail;
|
||||
|
||||
//标签
|
||||
private String label;
|
||||
|
||||
//是否默认 0否 1是
|
||||
private Integer isDefault;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BaiduMap {
|
||||
private String address;
|
||||
private String output;
|
||||
private String ak;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Category implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//类型: 1菜品分类 2套餐分类
|
||||
private Integer type;
|
||||
|
||||
//分类名称
|
||||
private String name;
|
||||
|
||||
//顺序
|
||||
private Integer sort;
|
||||
|
||||
//分类状态 0标识禁用 1表示启用
|
||||
private Integer status;
|
||||
|
||||
//创建时间
|
||||
private LocalDateTime createTime;
|
||||
|
||||
//更新时间
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
//创建人
|
||||
private Long createUser;
|
||||
|
||||
//修改人
|
||||
private Long updateUser;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 商品分类
|
||||
* </p>
|
||||
*
|
||||
* @author Bunny
|
||||
* @since 2024-03-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "分类实体类")
|
||||
public class CategoryTest implements Serializable {
|
||||
|
||||
@Schema(description = "分类名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分类图片url")
|
||||
private String imageUrl;
|
||||
|
||||
@Schema(description = "父节点id")
|
||||
private Long parentId;
|
||||
|
||||
@Schema(description = "分类状态: 是否显示[0-不显示,1显示]")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "排序字段")
|
||||
private Integer orderNum;
|
||||
|
||||
@Schema(description = "是否存在子节点")
|
||||
private Boolean hasChildren;
|
||||
|
||||
@Schema(description = "子节点List集合")
|
||||
private List<Category> children;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 菜品
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Dish implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//菜品名称
|
||||
private String name;
|
||||
|
||||
//菜品分类id
|
||||
private Long categoryId;
|
||||
|
||||
//菜品价格
|
||||
private BigDecimal price;
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
|
||||
//描述信息
|
||||
private String description;
|
||||
|
||||
//0 停售 1 起售
|
||||
private Integer status;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private Long createUser;
|
||||
|
||||
private Long updateUser;
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 菜品口味
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DishFlavor implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
//口味名称
|
||||
private String name;
|
||||
|
||||
//口味数据list
|
||||
private String value;
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Employee implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
private String username;
|
||||
|
||||
private String name;
|
||||
|
||||
private String password;
|
||||
|
||||
private String phone;
|
||||
|
||||
private String sex;
|
||||
|
||||
private String idNumber;
|
||||
|
||||
private Integer status;
|
||||
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private Long createUser;
|
||||
|
||||
private Long updateUser;
|
||||
private String shopAddress;
|
||||
private String employeeAddress;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 订单明细
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//名称
|
||||
private String name;
|
||||
|
||||
//订单id
|
||||
private Long orderId;
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
//套餐id
|
||||
private Long setmealId;
|
||||
|
||||
//口味
|
||||
private String dishFlavor;
|
||||
|
||||
//数量
|
||||
private Integer number;
|
||||
|
||||
//金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Orders implements Serializable {
|
||||
|
||||
/**
|
||||
* 订单状态 1待付款 2待接单 3已接单 4派送中 5已完成 6已取消
|
||||
*/
|
||||
public static final Integer PENDING_PAYMENT = 1;
|
||||
public static final Integer TO_BE_CONFIRMED = 2;
|
||||
public static final Integer CONFIRMED = 3;
|
||||
public static final Integer DELIVERY_IN_PROGRESS = 4;
|
||||
public static final Integer COMPLETED = 5;
|
||||
public static final Integer CANCELLED = 6;
|
||||
|
||||
/**
|
||||
* 支付状态 0未支付 1已支付 2退款
|
||||
*/
|
||||
public static final Integer UN_PAID = 0;
|
||||
public static final Integer PAID = 1;
|
||||
public static final Integer REFUND = 2;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//订单号
|
||||
private String number;
|
||||
|
||||
//订单状态 1待付款 2待接单 3已接单 4派送中 5已完成 6已取消 7退款
|
||||
private Integer status;
|
||||
|
||||
//下单用户id
|
||||
private Long userId;
|
||||
|
||||
//地址id
|
||||
private Long addressBookId;
|
||||
|
||||
//下单时间
|
||||
private LocalDateTime orderTime;
|
||||
|
||||
//结账时间
|
||||
private LocalDateTime checkoutTime;
|
||||
|
||||
//支付方式 1微信,2支付宝
|
||||
private Integer payMethod;
|
||||
|
||||
//支付状态 0未支付 1已支付 2退款
|
||||
private Integer payStatus;
|
||||
|
||||
//实收金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//备注
|
||||
private String remark;
|
||||
|
||||
//用户名
|
||||
private String userName;
|
||||
|
||||
//手机号
|
||||
private String phone;
|
||||
|
||||
//地址
|
||||
private String address;
|
||||
|
||||
//收货人
|
||||
private String consignee;
|
||||
|
||||
//订单取消原因
|
||||
private String cancelReason;
|
||||
|
||||
//订单拒绝原因
|
||||
private String rejectionReason;
|
||||
|
||||
//订单取消时间
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
//预计送达时间
|
||||
private LocalDateTime estimatedDeliveryTime;
|
||||
|
||||
//配送状态 1立即送出 0选择具体时间
|
||||
private Integer deliveryStatus;
|
||||
|
||||
//送达时间
|
||||
private LocalDateTime deliveryTime;
|
||||
|
||||
//打包费
|
||||
private int packAmount;
|
||||
|
||||
//餐具数量
|
||||
private int tablewareNumber;
|
||||
|
||||
//餐具数量状态 1按餐量提供 0选择具体数量
|
||||
private Integer tablewareStatus;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 套餐
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class Setmeal implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
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 LocalDateTime createTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private Long createUser;
|
||||
|
||||
private Long updateUser;
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 套餐菜品关系
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SetmealDish implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//套餐id
|
||||
private Long setmealId;
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
//菜品名称 (冗余字段)
|
||||
private String name;
|
||||
|
||||
//菜品原价
|
||||
private BigDecimal price;
|
||||
|
||||
//份数
|
||||
private Integer copies;
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 购物车
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShoppingCart implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//名称
|
||||
private String name;
|
||||
|
||||
//用户id
|
||||
private Long userId;
|
||||
|
||||
//菜品id
|
||||
private Long dishId;
|
||||
|
||||
//套餐id
|
||||
private Long setmealId;
|
||||
|
||||
//口味
|
||||
private String dishFlavor;
|
||||
|
||||
//数量
|
||||
private Integer number;
|
||||
|
||||
//金额
|
||||
private BigDecimal amount;
|
||||
|
||||
//图片
|
||||
private String image;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.sky.pojo.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class User implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
//微信用户唯一标识
|
||||
private String openid;
|
||||
|
||||
//姓名
|
||||
private String name;
|
||||
|
||||
//手机号
|
||||
private String phone;
|
||||
|
||||
//性别 0 女 1 男
|
||||
private String sex;
|
||||
|
||||
//身份证号
|
||||
private String idNumber;
|
||||
|
||||
//头像
|
||||
private String avatar;
|
||||
|
||||
//注册时间
|
||||
private LocalDateTime createTime;
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 数据概览
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BusinessDataVO implements Serializable {
|
||||
|
||||
private Double turnover;//营业额
|
||||
|
||||
private Integer validOrderCount;//有效订单数
|
||||
|
||||
private Double orderCompletionRate;//订单完成率
|
||||
|
||||
private Double unitPrice;//平均客单价
|
||||
|
||||
private Integer newUsers;//新增用户数
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DishItemVO implements Serializable {
|
||||
|
||||
//菜品名称
|
||||
private String name;
|
||||
|
||||
//份数
|
||||
private Integer copies;
|
||||
|
||||
//菜品图片
|
||||
private String image;
|
||||
|
||||
//菜品描述
|
||||
private String description;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 菜品总览
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DishOverViewVO implements Serializable {
|
||||
// 已启售数量
|
||||
private Integer sold;
|
||||
|
||||
// 已停售数量
|
||||
private Integer discontinued;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import com.sky.pojo.entity.DishFlavor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DishVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
//菜品名称
|
||||
private String name;
|
||||
//菜品分类id
|
||||
private Long categoryId;
|
||||
//菜品价格
|
||||
private BigDecimal price;
|
||||
//图片
|
||||
private String image;
|
||||
//描述信息
|
||||
private String description;
|
||||
//0 停售 1 起售
|
||||
private Integer status;
|
||||
//更新时间
|
||||
private LocalDateTime updateTime;
|
||||
//分类名称
|
||||
private String categoryName;
|
||||
//菜品关联的口味
|
||||
private List<DishFlavor> flavors = new ArrayList<>();
|
||||
|
||||
//private Integer copies;
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "员工登录返回的数据格式")
|
||||
public class EmployeeLoginVO implements Serializable {
|
||||
|
||||
@ApiModelProperty("主键值")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("jwt令牌")
|
||||
private String token;
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 订单概览数据
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderOverViewVO implements Serializable {
|
||||
//待接单数量
|
||||
private Integer waitingOrders;
|
||||
|
||||
//待派送数量
|
||||
private Integer deliveredOrders;
|
||||
|
||||
//已完成数量
|
||||
private Integer completedOrders;
|
||||
|
||||
//已取消数量
|
||||
private Integer cancelledOrders;
|
||||
|
||||
//全部订单
|
||||
private Integer allOrders;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderPaymentVO implements Serializable {
|
||||
|
||||
private String nonceStr; //随机字符串
|
||||
private String paySign; //签名
|
||||
private String timeStamp; //时间戳
|
||||
private String signType; //签名算法
|
||||
private String packageStr; //统一下单接口返回的 prepay_id 参数值
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderReportVO implements Serializable {
|
||||
|
||||
//日期,以逗号分隔,例如:2022-10-01,2022-10-02,2022-10-03
|
||||
private String dateList;
|
||||
|
||||
//每日订单数,以逗号分隔,例如:260,210,215
|
||||
private String orderCountList;
|
||||
|
||||
//每日有效订单数,以逗号分隔,例如:20,21,10
|
||||
private String validOrderCountList;
|
||||
|
||||
//订单总数
|
||||
private Integer totalOrderCount;
|
||||
|
||||
//有效订单数
|
||||
private Integer validOrderCount;
|
||||
|
||||
//订单完成率
|
||||
private Double orderCompletionRate;
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OrderStatisticsVO implements Serializable {
|
||||
//待接单数量
|
||||
private Integer toBeConfirmed;
|
||||
|
||||
//待派送数量
|
||||
private Integer confirmed;
|
||||
|
||||
//派送中数量
|
||||
private Integer deliveryInProgress;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderSubmitVO implements Serializable {
|
||||
//订单id
|
||||
private Long id;
|
||||
//订单号
|
||||
private String orderNumber;
|
||||
//订单金额
|
||||
private BigDecimal orderAmount;
|
||||
//下单时间
|
||||
private LocalDateTime orderTime;
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import com.sky.pojo.entity.OrderDetail;
|
||||
import com.sky.pojo.entity.Orders;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class OrderVO extends Orders implements Serializable {
|
||||
// 订单菜品信息
|
||||
private String orderDishes;
|
||||
|
||||
// 订单详情
|
||||
private List<OrderDetail> orderDetailList;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SalesTop10ReportVO implements Serializable {
|
||||
|
||||
//商品名称列表,以逗号分隔,例如:鱼香肉丝,宫保鸡丁,水煮鱼
|
||||
private String nameList;
|
||||
|
||||
//销量列表,以逗号分隔,例如:260,215,200
|
||||
private String numberList;
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 套餐总览
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SetmealOverViewVO implements Serializable {
|
||||
// 已启售数量
|
||||
private Integer sold;
|
||||
|
||||
// 已停售数量
|
||||
private Integer discontinued;
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import com.sky.pojo.entity.SetmealDish;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SetmealVO 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 LocalDateTime updateTime;
|
||||
|
||||
//分类名称
|
||||
private String categoryName;
|
||||
|
||||
//套餐和菜品的关联关系
|
||||
private List<SetmealDish> setmealDishes = new ArrayList<>();
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class TurnoverReportVO implements Serializable {
|
||||
// 日期,以逗号分隔,例如:2022-10-01,2022-10-02,2022-10-03
|
||||
private String dateList;
|
||||
|
||||
// 营业额,以逗号分隔,例如:406.0,1520.0,75.0
|
||||
private String turnoverList;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserLoginVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
private String openid;
|
||||
private String token;
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.sky.pojo.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserReportVO implements Serializable {
|
||||
|
||||
//日期,以逗号分隔,例如:2022-10-01,2022-10-02,2022-10-03
|
||||
private String dateList;
|
||||
|
||||
//用户总量,以逗号分隔,例如:200,210,220
|
||||
private String totalUserList;
|
||||
|
||||
//新增用户,以逗号分隔,例如:20,21,10
|
||||
private String newUserList;
|
||||
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,152 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>dev-sky-serve-v1</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>sky-server</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>sky-server</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>sky-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>sky-pojo</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-cache</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.xml.bind</groupId>
|
||||
<artifactId>jaxb-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- poi -->
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
</dependency>
|
||||
<!-- minio -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>15</source>
|
||||
<target>15</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -0,0 +1,19 @@
|
|||
package com.sky;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement // 开启注解方式的事务管理
|
||||
@EnableCaching// 开启缓存注解
|
||||
@EnableScheduling
|
||||
@Slf4j
|
||||
public class SkyApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SkyApplication.class);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
|
||||
import com.sky.common.result.PageResult;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.dto.CategoryDTO;
|
||||
import com.sky.pojo.dto.CategoryPageQueryDTO;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 分类管理
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/category")
|
||||
@Api(tags = "分类相关接口")
|
||||
@Slf4j
|
||||
public class CategoryController {
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增分类")
|
||||
public Result<String> save(@RequestBody CategoryDTO categoryDTO) {
|
||||
log.info("新增分类:{}", categoryDTO);
|
||||
categoryService.save(categoryDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("分类分页查询")
|
||||
public Result<PageResult<Category>> page(CategoryPageQueryDTO categoryPageQueryDTO) {
|
||||
log.info("分页查询:{}", categoryPageQueryDTO);
|
||||
PageResult<Category> pageResult = categoryService.pageQuery(categoryPageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除分类")
|
||||
public Result<String> deleteById(Long id) {
|
||||
log.info("删除分类:{}", id);
|
||||
categoryService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改分类")
|
||||
public Result<String> update(@RequestBody CategoryDTO categoryDTO) {
|
||||
categoryService.update(categoryDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/status/{status}")
|
||||
@ApiOperation("启用禁用分类")
|
||||
public Result<String> startOrStop(@PathVariable("status") Integer status, Long id) {
|
||||
categoryService.startOrStop(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("根据类型查询分类")
|
||||
public Result<List<Category>> list(Integer type) {
|
||||
List<Category> list = categoryService.list(type);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
|
||||
import com.sky.common.constant.MessageConstant;
|
||||
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.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/common")
|
||||
@Api(tags = "通用接口")
|
||||
@Slf4j
|
||||
public class CommonController {
|
||||
private final MinioService minioService;
|
||||
|
||||
@ApiOperation(value = "文件上传")
|
||||
@PostMapping("/upload")
|
||||
public Result<String> upload(MultipartFile file) {
|
||||
log.info("文件上传:{}", file);
|
||||
try {
|
||||
String filename = minioService.upload(file);
|
||||
return Result.success(filename);
|
||||
} catch (IOException e) {
|
||||
log.info("文件上传失败");
|
||||
return Result.error(MessageConstant.UPLOAD_FAILED);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
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;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/dish")
|
||||
@Api(tags = "菜品相关接口")
|
||||
@Slf4j
|
||||
public class DishController {
|
||||
private final DishService dishService;
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增菜品")
|
||||
public Result<DishDTO> save(@RequestBody DishDTO dishDTO) {
|
||||
log.info("新增菜品:{}", dishDTO);
|
||||
// 删除redis中缓存
|
||||
RedisUtil.cleanCache("dish_" + dishDTO.getCategoryId());
|
||||
dishService.saveWithFlavor(dishDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("菜品分页查询")
|
||||
public Result<PageResult<DishVO>> page(DishPageQueryDTO dishPageQueryDTO) {
|
||||
log.info("菜品分页查询:{}", dishPageQueryDTO);
|
||||
PageResult<DishVO> pageResult = dishService.pageQuery(dishPageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("菜品批量删除")
|
||||
public Result<String> delete(@RequestParam List<Long> ids) {
|
||||
log.info("菜品批量删除:{}", ids);
|
||||
dishService.deleteBatch(ids);
|
||||
// 将菜品数据删除
|
||||
RedisUtil.cleanCache("dish_*");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("根据id查询菜品和对应的口味数据")
|
||||
public Result<DishVO> getById(@PathVariable Long id) {
|
||||
log.info("根据id查询菜品和对应的口味数据:{}", id);
|
||||
DishVO dishVO = dishService.getById(id);
|
||||
return Result.success(dishVO);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("修改菜品")
|
||||
public Result<DishDTO> update(@RequestBody DishDTO dto) {
|
||||
log.info("修改菜品:{}", dto);
|
||||
dishService.updateWithFlavor(dto);
|
||||
// 将菜品数据删除
|
||||
RedisUtil.cleanCache("dish_*");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("status/{status}")
|
||||
@ApiOperation("菜品起售、停售")
|
||||
public Result<String> status(@PathVariable Integer status, Long id) {
|
||||
log.info("菜品起售、停售:{},菜品id:{}", status, id);
|
||||
dishService.updateWithStatus(status, id);
|
||||
// 将菜品数据删除
|
||||
RedisUtil.cleanCache("dish_*");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("list")
|
||||
@ApiOperation("根据分类id查询菜品")
|
||||
public Result<List<Dish>> list(Long categoryId) {
|
||||
log.info("根据分类id查询菜品:{}", categoryId);
|
||||
List<Dish> dishVOList = dishService.getByCategoryId(categoryId);
|
||||
return Result.success(dishVOList);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.common.constant.JwtClaimsConstant;
|
||||
import com.sky.common.properties.JwtProperties;
|
||||
import com.sky.common.result.PageResult;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.common.utils.JwtUtil;
|
||||
import com.sky.pojo.dto.EmployeeDTO;
|
||||
import com.sky.pojo.dto.EmployeeLoginDTO;
|
||||
import com.sky.pojo.dto.EmployeePageQueryDTO;
|
||||
import com.sky.pojo.dto.PasswordEditDTO;
|
||||
import com.sky.pojo.entity.Employee;
|
||||
import com.sky.pojo.vo.EmployeeLoginVO;
|
||||
import com.sky.service.EmployeeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 员工管理
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/employee")
|
||||
@Slf4j
|
||||
@Api(tags = "员工相关接口")
|
||||
public class EmployeeController {
|
||||
|
||||
@Autowired
|
||||
private EmployeeService employeeService;
|
||||
@Autowired
|
||||
private JwtProperties jwtProperties;
|
||||
|
||||
@PostMapping("/login")
|
||||
@ApiOperation(value = "登录接口")
|
||||
public Result<EmployeeLoginVO> login(@RequestBody EmployeeLoginDTO employeeLoginDTO) {
|
||||
log.info("员工登录:{}", employeeLoginDTO);
|
||||
|
||||
Employee employee = employeeService.login(employeeLoginDTO);
|
||||
|
||||
// 登录成功后,生成jwt令牌
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put(JwtClaimsConstant.EMP_ID, employee.getId());
|
||||
String token = JwtUtil.createJWT(jwtProperties.getAdminSecretKey(), jwtProperties.getAdminTtl(), claims);
|
||||
|
||||
EmployeeLoginVO employeeLoginVO = EmployeeLoginVO.builder()
|
||||
.id(employee.getId())
|
||||
.userName(employee.getUsername())
|
||||
.name(employee.getName())
|
||||
.token(token).build();
|
||||
|
||||
return Result.success(employeeLoginVO);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
@ApiOperation(value = "退出登录")
|
||||
public Result<String> logout() {
|
||||
log.info("退出登录");
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("")
|
||||
@ApiOperation("新增员工")
|
||||
public Result<String> save(@RequestBody EmployeeDTO employeeDTO) {
|
||||
log.info("新增员工:{}", employeeDTO);
|
||||
employeeService.save(employeeDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("员工分页查询")
|
||||
public Result<PageResult> page(EmployeePageQueryDTO employeePageQueryDTO) {
|
||||
log.info("员工分页查询,参数:{}", employeePageQueryDTO);
|
||||
PageResult pageResult = employeeService.pageQuery(employeePageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@PostMapping("/status/{status}")
|
||||
@ApiOperation("启用禁用员工账号")
|
||||
public Result startOrStop(@PathVariable Integer status, Long id) {
|
||||
log.info("启用禁用员工账号:{},{}", status, id);
|
||||
employeeService.startOrStop(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("根据id查询员工信息")
|
||||
public Result<Employee> getById(@PathVariable Long id) {
|
||||
Employee employee = employeeService.getById(id);
|
||||
return Result.success(employee);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("编辑员工信息")
|
||||
public Result update(@RequestBody EmployeeDTO employeeDTO) {
|
||||
log.info("编辑员工信息:{}", employeeDTO);
|
||||
employeeService.update(employeeDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("editPassword")
|
||||
@ApiOperation("修改密码")
|
||||
public Result editPassword(@RequestBody PasswordEditDTO passwordEditDTO) {
|
||||
log.info("修改密码:{}", passwordEditDTO);
|
||||
employeeService.editPassword(passwordEditDTO);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.common.result.PageResult;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.dto.OrdersCancelDTO;
|
||||
import com.sky.pojo.dto.OrdersConfirmDTO;
|
||||
import com.sky.pojo.dto.OrdersPageQueryDTO;
|
||||
import com.sky.pojo.dto.OrdersRejectionDTO;
|
||||
import com.sky.pojo.vo.OrderStatisticsVO;
|
||||
import com.sky.pojo.vo.OrderVO;
|
||||
import com.sky.service.OrderService;
|
||||
import com.sky.service.utils.CheckOutOfRangeUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController("adminOrderController")
|
||||
@RequestMapping("/admin/order")
|
||||
@Slf4j
|
||||
@Api(tags = "订单管理接口")
|
||||
public class OrderController {
|
||||
@Autowired
|
||||
OrderService orderService;
|
||||
@Autowired
|
||||
CheckOutOfRangeUtils checkOutOfRangeUtils;
|
||||
|
||||
@GetMapping("/conditionSearch")
|
||||
@ApiOperation(value = "订单搜索")
|
||||
public Result<PageResult<OrderVO>> conditionSearch(OrdersPageQueryDTO dto) {
|
||||
PageResult<OrderVO> pageResult = orderService.conditionSearch(dto);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("/statistics")
|
||||
@ApiOperation("各个状态的订单数量统计")
|
||||
public Result<OrderStatisticsVO> statistics() {
|
||||
OrderStatisticsVO orderStatisticsVO = orderService.statistics();
|
||||
return Result.success(orderStatisticsVO);
|
||||
}
|
||||
|
||||
@GetMapping("/details/{id}")
|
||||
@ApiOperation("查询订单详情")
|
||||
public Result<OrderVO> details(@PathVariable Long id) {
|
||||
OrderVO details = orderService.details(id);
|
||||
return Result.success(details);
|
||||
}
|
||||
|
||||
@PutMapping("/confirm")
|
||||
@ApiOperation("接单")
|
||||
public Result<String> confirm(@RequestBody OrdersConfirmDTO dto) {
|
||||
orderService.confirm(dto);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/rejection")
|
||||
@ApiOperation("拒单")
|
||||
public Result<String> rejection(@RequestBody OrdersRejectionDTO dto) {
|
||||
orderService.rejection(dto);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/cancel")
|
||||
@ApiOperation("取消订单")
|
||||
public Result<String> cancelBusiness(@RequestBody OrdersCancelDTO dto) throws Exception {
|
||||
orderService.cancelBusiness(dto);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/delivery/{id}")
|
||||
@ApiOperation("派送订单")
|
||||
public Result<String> delivery(@PathVariable("id") Long id) {
|
||||
orderService.delivery(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/complete/{id}")
|
||||
@ApiOperation("完成订单")
|
||||
public Result<String> complete(@PathVariable("id") Long id) {
|
||||
orderService.complete(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.vo.OrderReportVO;
|
||||
import com.sky.pojo.vo.SalesTop10ReportVO;
|
||||
import com.sky.pojo.vo.TurnoverReportVO;
|
||||
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.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/report")
|
||||
@Slf4j
|
||||
@Api(tags = "统计报表相关接口")
|
||||
public class ReportController {
|
||||
private final ReportService reportService;
|
||||
|
||||
@GetMapping("/turnoverStatistics")
|
||||
@ApiOperation(value = "营业额数据统计")
|
||||
public Result<TurnoverReportVO> turnoverStatistics(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin, @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
|
||||
log.info("营业额数据统计:开始时间:{},结束时间:{}", begin, end);
|
||||
TurnoverReportVO turnover = reportService.getTurnover(begin, end);
|
||||
return Result.success(turnover);
|
||||
}
|
||||
|
||||
@GetMapping("/userStatistics")
|
||||
@ApiOperation(value = "用户数据统计")
|
||||
public Result<UserReportVO> userStatistics(
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
|
||||
log.info("用户数据统计:开始时间:{},结束时间:{}", begin, end);
|
||||
UserReportVO userStatistics = reportService.getUserStatistics(begin, end);
|
||||
return Result.success(userStatistics);
|
||||
}
|
||||
|
||||
@GetMapping("ordersStatistics")
|
||||
@ApiOperation(value = "订单统计接口")
|
||||
public Result<OrderReportVO> ordersStatistics(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
|
||||
log.info("订单统计接口:开始时间:{},结束时间:{}", begin, end);
|
||||
OrderReportVO orderReportVO = reportService.getOrdersStatistics(begin, end);
|
||||
return Result.success(orderReportVO);
|
||||
}
|
||||
|
||||
@GetMapping("top10")
|
||||
@ApiOperation(value = "查询销量排名top10接口")
|
||||
public Result<SalesTop10ReportVO> top10(@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate begin,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
|
||||
log.info("订单统计接口:开始时间:{},结束时间:{}", begin, end);
|
||||
SalesTop10ReportVO top10Report = reportService.getTop10Statistics(begin, end);
|
||||
return Result.success(top10Report);
|
||||
}
|
||||
|
||||
@GetMapping("export")
|
||||
@ApiOperation(value = "导出Excel报表接口")
|
||||
public void export(HttpServletResponse response) {
|
||||
log.info("导出Excel报表接口");
|
||||
reportService.exportBusinessData(response);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.common.result.PageResult;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.dto.SetmealDTO;
|
||||
import com.sky.pojo.dto.SetmealPageQueryDTO;
|
||||
import com.sky.pojo.vo.SetmealVO;
|
||||
import com.sky.service.SetmealService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/setmeal")
|
||||
@Slf4j
|
||||
@Api(tags = "套餐相关接口")
|
||||
public class SetMealController {
|
||||
@Autowired
|
||||
SetmealService setmealService;
|
||||
|
||||
@GetMapping("page")
|
||||
@ApiOperation("分页查询")
|
||||
public Result<PageResult<SetmealVO>> page(SetmealPageQueryDTO dto) {
|
||||
log.info("分页查询:{}", dto);
|
||||
PageResult<SetmealVO> pageResult = setmealService.pageQuery(dto);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("{id}")
|
||||
@ApiOperation("根据id查询套餐")
|
||||
public Result<SetmealVO> page4Id(@PathVariable Long id) {
|
||||
log.info("根据id查询套餐:{}", id);
|
||||
SetmealVO setmealVO = setmealService.page4Id(id);
|
||||
return Result.success(setmealVO);
|
||||
}
|
||||
|
||||
@PutMapping()
|
||||
@ApiOperation("修改套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache", allEntries = true)
|
||||
public Result<String> update(@RequestBody SetmealDTO setmealDTO) {
|
||||
log.info("修改套餐:{}", setmealDTO);
|
||||
setmealService.update(setmealDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("")
|
||||
@ApiOperation("新增套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache", key = "#setmealDTO.categoryId")
|
||||
public Result<String> setmeal(@RequestBody SetmealDTO setmealDTO) {
|
||||
log.info("新增套餐:{}", setmealDTO);
|
||||
setmealService.insert(setmealDTO);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("status/{status}")
|
||||
@ApiOperation("套餐起售、停售")
|
||||
@CacheEvict(cacheNames = "setmealCache", allEntries = true)
|
||||
public Result<String> updateStatus(@PathVariable Integer status, Long id) {
|
||||
log.info("套餐起售、停售,状态:{},id:{}", status, id);
|
||||
setmealService.updateStatus(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping("")
|
||||
@ApiOperation("批量删除套餐")
|
||||
@CacheEvict(cacheNames = "setmealCache", allEntries = true)
|
||||
public Result<String> delete(@RequestParam List<Long> ids) {
|
||||
log.info("批量删除套餐:{}", ids);
|
||||
setmealService.delete(ids);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
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.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";
|
||||
private final RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
@PutMapping("/{status}")
|
||||
@ApiOperation("设置店铺的营业状态")
|
||||
public Result<String> setStatus(@PathVariable Integer status) {
|
||||
log.info("设置店铺的营业状态为:{}", status == 1 ? "营业中" : "打烊中");
|
||||
redisTemplate.opsForValue().set(KEY, status);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/status")
|
||||
@ApiOperation("获取店铺的营业状态")
|
||||
public Result<Integer> getStatus() {
|
||||
Integer status = (Integer) redisTemplate.opsForValue().get(KEY);
|
||||
if (status != null) {
|
||||
log.info("获取到店铺的营业状态为:{}", status == 1 ? "营业中" : "打烊中");
|
||||
return Result.success(status);
|
||||
}
|
||||
log.error(MessageConstant.NOT_SET_STATUS);
|
||||
return Result.error(MessageConstant.NOT_SET_STATUS);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.vo.BusinessDataVO;
|
||||
import com.sky.pojo.vo.DishOverViewVO;
|
||||
import com.sky.pojo.vo.OrderOverViewVO;
|
||||
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.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 工作台
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/admin/workspace")
|
||||
@Slf4j
|
||||
@Api(tags = "工作台相关接口")
|
||||
public class WorkSpaceController {
|
||||
|
||||
private final WorkspaceService workspaceService;
|
||||
|
||||
@GetMapping("/businessData")
|
||||
@ApiOperation("工作台今日数据查询")
|
||||
public Result<BusinessDataVO> businessData() {
|
||||
// 获得当天的开始时间
|
||||
LocalDateTime begin = LocalDateTime.now().with(LocalTime.MIN);
|
||||
// 获得当天的结束时间
|
||||
LocalDateTime end = LocalDateTime.now().with(LocalTime.MAX);
|
||||
|
||||
BusinessDataVO businessDataVO = workspaceService.getBusinessData(begin, end);
|
||||
return Result.success(businessDataVO);
|
||||
}
|
||||
|
||||
@GetMapping("/overviewOrders")
|
||||
@ApiOperation("查询订单管理数据")
|
||||
public Result<OrderOverViewVO> orderOverView() {
|
||||
return Result.success(workspaceService.getOrderOverView());
|
||||
}
|
||||
|
||||
@GetMapping("/overviewDishes")
|
||||
@ApiOperation("查询菜品总览")
|
||||
public Result<DishOverViewVO> dishOverView() {
|
||||
return Result.success(workspaceService.getDishOverView());
|
||||
}
|
||||
|
||||
@GetMapping("/overviewSetmeals")
|
||||
@ApiOperation("查询套餐总览")
|
||||
public Result<SetmealOverViewVO> setmealOverView() {
|
||||
return Result.success(workspaceService.getSetmealOverView());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
package com.sky.controller.notify;
|
||||
|
||||
import com.alibaba.druid.support.json.JSONUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
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.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 支付回调相关接口
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/notify")
|
||||
@Slf4j
|
||||
public class PayNotifyController {
|
||||
private final OrderService orderService;
|
||||
private final WeChatProperties weChatProperties;
|
||||
|
||||
/**
|
||||
* 支付成功回调
|
||||
*/
|
||||
@RequestMapping("/paySuccess")
|
||||
@ApiOperation(value = "支付成功")
|
||||
public void paySuccessNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
// 读取数据
|
||||
String body = readData(request);
|
||||
log.info("支付成功回调:{}", body);
|
||||
|
||||
// 数据解密
|
||||
String plainText = decryptData(body);
|
||||
// String plainText = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
log.info("解密后的文本:{}", plainText);
|
||||
|
||||
JSONObject jsonObject = JSON.parseObject(plainText);
|
||||
String outTradeNo = jsonObject.getString("out_trade_no");// 商户平台订单号
|
||||
// String transactionId = jsonObject.getString("transaction_id");// 微信支付交易号
|
||||
// String outTradeNo = "1704854920332";// 商户平台订单号
|
||||
String transactionId = UUID.randomUUID().toString();// 微信支付交易号
|
||||
|
||||
log.info("商户平台订单号:{}", outTradeNo);
|
||||
log.info("微信支付交易号:{}", transactionId);
|
||||
|
||||
// 业务处理,修改订单状态、来单提醒
|
||||
orderService.paySuccess(outTradeNo);
|
||||
|
||||
// 给微信响应
|
||||
responseToWeixin(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取数据
|
||||
*/
|
||||
private String readData(HttpServletRequest request) throws Exception {
|
||||
BufferedReader reader = request.getReader();
|
||||
StringBuilder result = new StringBuilder();
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
if (!result.isEmpty()) {
|
||||
result.append("\n");
|
||||
}
|
||||
result.append(line);
|
||||
}
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据解密
|
||||
*/
|
||||
private String decryptData(String body) throws Exception {
|
||||
JSONObject resultObject = JSON.parseObject(body);
|
||||
JSONObject resource = resultObject.getJSONObject("resource");
|
||||
String ciphertext = resource.getString("ciphertext");
|
||||
String nonce = resource.getString("nonce");
|
||||
String associatedData = resource.getString("associated_data");
|
||||
|
||||
AesUtil aesUtil = new AesUtil(weChatProperties.getApiV3Key().getBytes(StandardCharsets.UTF_8));
|
||||
// 密文解密
|
||||
|
||||
return aesUtil.decryptToString(associatedData.getBytes(StandardCharsets.UTF_8),
|
||||
nonce.getBytes(StandardCharsets.UTF_8),
|
||||
ciphertext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 给微信响应
|
||||
*/
|
||||
private void responseToWeixin(HttpServletResponse response) throws Exception {
|
||||
response.setStatus(200);
|
||||
HashMap<Object, Object> map = new HashMap<>();
|
||||
map.put("code", "SUCCESS");
|
||||
map.put("message", "SUCCESS");
|
||||
response.setHeader("Content-type", ContentType.APPLICATION_JSON.toString());
|
||||
response.getOutputStream().write(JSONUtils.toJSONString(map).getBytes(StandardCharsets.UTF_8));
|
||||
response.flushBuffer();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package com.sky.controller.user;
|
||||
|
||||
import com.sky.common.context.BaseContext;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.entity.AddressBook;
|
||||
import com.sky.service.AddressBookService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/addressBook")
|
||||
@Api(tags = "C端地址簿接口")
|
||||
public class AddressBookController {
|
||||
private final AddressBookService addressBookService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询当前登录用户的所有地址信息")
|
||||
public Result<List<AddressBook>> list() {
|
||||
AddressBook addressBook = new AddressBook();
|
||||
addressBook.setUserId(BaseContext.getUserId());
|
||||
List<AddressBook> list = addressBookService.list(addressBook);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@ApiOperation("新增地址")
|
||||
public Result<AddressBook> save(@RequestBody AddressBook addressBook) {
|
||||
addressBookService.save(addressBook);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("/{id}")
|
||||
@ApiOperation("根据id查询地址")
|
||||
public Result<AddressBook> getById(@PathVariable Long id) {
|
||||
AddressBook addressBook = addressBookService.getById(id);
|
||||
return Result.success(addressBook);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@ApiOperation("根据id修改地址")
|
||||
public Result<AddressBook> update(@RequestBody AddressBook addressBook) {
|
||||
addressBookService.update(addressBook);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PutMapping("/default")
|
||||
@ApiOperation("设置默认地址")
|
||||
public Result<AddressBook> setDefault(@RequestBody AddressBook addressBook) {
|
||||
addressBookService.setDefault(addressBook);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@ApiOperation("根据id删除地址")
|
||||
public Result<AddressBook> deleteById(Long id) {
|
||||
addressBookService.deleteById(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询默认地址
|
||||
*/
|
||||
@GetMapping("default")
|
||||
@ApiOperation("查询默认地址")
|
||||
public Result<AddressBook> getDefault() {
|
||||
// SQL:select * from address_book where user_id = ? and is_default = 1
|
||||
AddressBook addressBook = new AddressBook();
|
||||
addressBook.setIsDefault(1);
|
||||
addressBook.setUserId(BaseContext.getUserId());
|
||||
List<AddressBook> list = addressBookService.list(addressBook);
|
||||
|
||||
if (list != null && list.size() == 1) {
|
||||
return Result.success(list.get(0));
|
||||
}
|
||||
|
||||
return Result.error("没有查询到默认地址");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.sky.controller.user;
|
||||
|
||||
import com.sky.common.result.Result;
|
||||
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 org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController("userCategoryController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/category")
|
||||
@Api(tags = "C端-分类接口")
|
||||
public class CategoryController {
|
||||
private final CategoryService categoryService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询分类")
|
||||
public Result<List<Category>> list(Integer type) {
|
||||
List<Category> list = categoryService.list(type);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.sky.controller.user;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.sky.common.constant.StatusConstant;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.entity.Dish;
|
||||
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.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@RestController("userDishController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/dish")
|
||||
@Slf4j
|
||||
@Api(tags = "C端-菜品浏览接口")
|
||||
public class DishController {
|
||||
private final RedisTemplate<Object, Object> redisTemplate;
|
||||
DishService dishService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("根据分类id查询菜品")
|
||||
public Result<List<DishVO>> list(Long categoryId) {
|
||||
// 构造redis中的key,规则dish_分类id
|
||||
String key = "dish_" + categoryId;
|
||||
// 查询redis中是否存在菜品数据
|
||||
List<DishVO> list = (List<DishVO>) redisTemplate.opsForValue().get(key);
|
||||
// 如果存在返回,无需查询数据库
|
||||
if (list != null && !list.isEmpty()) {
|
||||
return Result.success(list);
|
||||
}
|
||||
// 如果不存在查询数据库,将查询数据放入redis中
|
||||
Dish dish = new Dish();
|
||||
dish.setCategoryId(categoryId);
|
||||
dish.setStatus(StatusConstant.ENABLE);// 查询起售中的菜品
|
||||
|
||||
list = dishService.listWithFlavor(dish);
|
||||
redisTemplate.opsForValue().set(key, JSON.toJSON(list), 7, TimeUnit.DAYS);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package com.sky.controller.user;
|
||||
|
||||
import com.sky.common.result.PageResult;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.dto.OrdersPaymentDTO;
|
||||
import com.sky.pojo.dto.OrdersSubmitDTO;
|
||||
import com.sky.pojo.vo.OrderPaymentVO;
|
||||
import com.sky.pojo.vo.OrderSubmitVO;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 订单
|
||||
*/
|
||||
@RestController("userOrderController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/order")
|
||||
@Slf4j
|
||||
@Api(tags = "C端订单接口")
|
||||
public class OrderController {
|
||||
private final OrderService orderService;
|
||||
|
||||
@PostMapping("/submit")
|
||||
@ApiOperation("用户下单")
|
||||
public Result<OrderSubmitVO> submit(@RequestBody OrdersSubmitDTO ordersSubmitDTO) {
|
||||
log.info("用户下单:{}", ordersSubmitDTO);
|
||||
OrderSubmitVO orderSubmitVO = orderService.submitOrder(ordersSubmitDTO);
|
||||
return Result.success(orderSubmitVO);
|
||||
}
|
||||
|
||||
@PutMapping("/payment")
|
||||
@ApiOperation("订单支付")
|
||||
public Result<OrderPaymentVO> payment(@RequestBody OrdersPaymentDTO ordersPaymentDTO) throws Exception {
|
||||
log.info("订单支付:{}", ordersPaymentDTO);
|
||||
OrderPaymentVO orderPaymentVO = orderService.payment(ordersPaymentDTO);
|
||||
log.info("生成预支付交易单:{}", orderPaymentVO);
|
||||
return Result.success(orderPaymentVO);
|
||||
}
|
||||
|
||||
@GetMapping("historyOrders")
|
||||
@ApiOperation(value = "历史订单")
|
||||
public Result<PageResult> historyOrders(int page, int pageSize, Integer status) {
|
||||
log.info("历史订单:{}", page);
|
||||
PageResult pageResult = orderService.pageQuery4User(page, pageSize, status);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@GetMapping("orderDetail/{id}")
|
||||
@ApiOperation(value = "查询订单详情")
|
||||
public Result<OrderVO> orderDetail(@PathVariable Long id) {
|
||||
OrderVO orderVO = orderService.details(id);
|
||||
return Result.success(orderVO);
|
||||
}
|
||||
|
||||
@PutMapping("cancel/{id}")
|
||||
@ApiOperation("取消订单")
|
||||
public Result<String> cancel(@PathVariable("id") Long id) {
|
||||
orderService.cancel(id);
|
||||
return Result.success("操作成功");
|
||||
}
|
||||
|
||||
@PostMapping("/repetition/{id}")
|
||||
@ApiOperation("再来一单")
|
||||
public Result<String> repetition(@PathVariable Long id) {
|
||||
orderService.repetition(id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@GetMapping("reminder/{id}")
|
||||
@ApiOperation(value = "催单")
|
||||
public Result<String> reminder(@PathVariable("id") Long id) {
|
||||
log.info("催单:{}", id);
|
||||
orderService.reminder(id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.sky.controller.user;
|
||||
|
||||
import com.sky.common.constant.StatusConstant;
|
||||
import com.sky.common.result.Result;
|
||||
import com.sky.pojo.entity.Setmeal;
|
||||
import com.sky.pojo.vo.DishItemVO;
|
||||
import com.sky.service.SetmealService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController("userSetmealController")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/user/setmeal")
|
||||
@Api(tags = "C端-套餐浏览接口")
|
||||
public class SetmealController {
|
||||
private final SetmealService setmealService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("根据分类id查询套餐")
|
||||
@Cacheable(cacheNames = "setmealCache", key = "#categoryId")
|
||||
public Result<List<Setmeal>> list(Long categoryId) {
|
||||
Setmeal setmeal = new Setmeal();
|
||||
setmeal.setCategoryId(categoryId);
|
||||
setmeal.setStatus(StatusConstant.ENABLE);
|
||||
|
||||
List<Setmeal> list = setmealService.list(setmeal);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/dish/{id}")
|
||||
@ApiOperation("根据套餐id查询包含的菜品列表")
|
||||
public Result<List<DishItemVO>> dishList(@PathVariable("id") Long id) {
|
||||
List<DishItemVO> list = setmealService.getDishItemById(id);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue