branch
commit
f5ed328ec5
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<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,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,12 @@
|
||||
<?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>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="liberica-21" project-jdk-type="JavaSDK" />
|
||||
</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,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<version>2.7.3</version>
|
||||
</parent>
|
||||
<groupId>com.sky</groupId>
|
||||
<artifactId>sky-take-out</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<modules>
|
||||
<module>sky-common</module>
|
||||
<module>sky-pojo</module>
|
||||
<module>sky-server</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<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.2</knife4j>
|
||||
<aspectj>1.9.4</aspectj>
|
||||
<jjwt>0.9.1</jjwt>
|
||||
<jaxb-api>2.3.1</jaxb-api>
|
||||
<poi>3.16</poi>
|
||||
</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>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
||||
@ -0,0 +1,14 @@
|
||||
package com.sky.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,11 @@
|
||||
package com.sky.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,28 @@
|
||||
package com.sky.constant;
|
||||
|
||||
/**
|
||||
* 信息提示常量类
|
||||
*/
|
||||
public class MessageConstant {
|
||||
|
||||
public static final String PASSWORD_ERROR = "密码错误";
|
||||
public static final String ACCOUNT_NOT_FOUND = "账号不存在";
|
||||
public static final String ACCOUNT_LOCKED = "账号被锁定";
|
||||
public static final String ALREADY_EXISTS = "已存在";
|
||||
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_NOT_FOUND = "订单不存在";
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.sky.constant;
|
||||
|
||||
/**
|
||||
* 密码常量
|
||||
*/
|
||||
public class PasswordConstant {
|
||||
|
||||
public static final String DEFAULT_PASSWORD = "123456";
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.sky.context;
|
||||
|
||||
public class BaseContext {
|
||||
|
||||
public static ThreadLocal<Long> threadLocal = new ThreadLocal<>();
|
||||
|
||||
public static void setCurrentId(Long id) {
|
||||
threadLocal.set(id);
|
||||
}
|
||||
|
||||
public static Long getCurrentId() {
|
||||
return threadLocal.get();
|
||||
}
|
||||
|
||||
public static void removeCurrentId() {
|
||||
threadLocal.remove();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.sky.enumeration;
|
||||
|
||||
/**
|
||||
* 数据库操作类型
|
||||
*/
|
||||
public enum OperationType {
|
||||
|
||||
/**
|
||||
* 更新操作
|
||||
*/
|
||||
UPDATE,
|
||||
|
||||
/**
|
||||
* 插入操作
|
||||
*/
|
||||
INSERT
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 账号被锁定异常
|
||||
*/
|
||||
public class AccountLockedException extends BaseException {
|
||||
|
||||
public AccountLockedException() {
|
||||
}
|
||||
|
||||
public AccountLockedException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 账号不存在异常
|
||||
*/
|
||||
public class AccountNotFoundException extends BaseException {
|
||||
|
||||
public AccountNotFoundException() {
|
||||
}
|
||||
|
||||
public AccountNotFoundException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.sky.exception;
|
||||
|
||||
public class AddressBookBusinessException extends BaseException {
|
||||
|
||||
public AddressBookBusinessException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*/
|
||||
public class BaseException extends RuntimeException {
|
||||
|
||||
public BaseException() {
|
||||
}
|
||||
|
||||
public BaseException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.sky.exception;
|
||||
|
||||
public class DeletionNotAllowedException extends BaseException {
|
||||
|
||||
public DeletionNotAllowedException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 登录失败
|
||||
*/
|
||||
public class LoginFailedException extends BaseException{
|
||||
public LoginFailedException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.sky.exception;
|
||||
|
||||
public class OrderBusinessException extends BaseException {
|
||||
|
||||
public OrderBusinessException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 密码修改失败异常
|
||||
*/
|
||||
public class PasswordEditFailedException extends BaseException{
|
||||
|
||||
public PasswordEditFailedException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 密码错误异常
|
||||
*/
|
||||
public class PasswordErrorException extends BaseException {
|
||||
|
||||
public PasswordErrorException() {
|
||||
}
|
||||
|
||||
public PasswordErrorException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.sky.exception;
|
||||
|
||||
/**
|
||||
* 套餐启用失败异常
|
||||
*/
|
||||
public class SetmealEnableFailedException extends BaseException {
|
||||
|
||||
public SetmealEnableFailedException(){}
|
||||
|
||||
public SetmealEnableFailedException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.sky.exception;
|
||||
|
||||
public class ShoppingCartBusinessException extends BaseException {
|
||||
|
||||
public ShoppingCartBusinessException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.sky.exception;
|
||||
|
||||
public class UserNotLoginException extends BaseException {
|
||||
|
||||
public UserNotLoginException() {
|
||||
}
|
||||
|
||||
public UserNotLoginException(String msg) {
|
||||
super(msg);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.sky.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "sky.alioss")
|
||||
@Data
|
||||
public class AliOssProperties {
|
||||
|
||||
private String endpoint;
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String bucketName;
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.sky.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,23 @@
|
||||
package com.sky.properties;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
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,22 @@
|
||||
package com.sky.result;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 封装分页查询结果
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PageResult implements Serializable {
|
||||
|
||||
private long total; //总记录数
|
||||
|
||||
private List records; //当前页数据集合
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
package com.sky.utils;
|
||||
|
||||
import com.aliyun.oss.ClientException;
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.OSSException;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Slf4j
|
||||
public class AliOssUtil {
|
||||
|
||||
private String endpoint;
|
||||
private String accessKeyId;
|
||||
private String accessKeySecret;
|
||||
private String bucketName;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
*
|
||||
* @param bytes
|
||||
* @param objectName
|
||||
* @return
|
||||
*/
|
||||
public String upload(byte[] bytes, String objectName) {
|
||||
|
||||
// 创建OSSClient实例。
|
||||
OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
|
||||
|
||||
try {
|
||||
// 创建PutObject请求。
|
||||
ossClient.putObject(bucketName, objectName, new ByteArrayInputStream(bytes));
|
||||
} catch (OSSException oe) {
|
||||
System.out.println("Caught an OSSException, which means your request made it to OSS, "
|
||||
+ "but was rejected with an error response for some reason.");
|
||||
System.out.println("Error Message:" + oe.getErrorMessage());
|
||||
System.out.println("Error Code:" + oe.getErrorCode());
|
||||
System.out.println("Request ID:" + oe.getRequestId());
|
||||
System.out.println("Host ID:" + oe.getHostId());
|
||||
} catch (ClientException ce) {
|
||||
System.out.println("Caught an ClientException, which means the client encountered "
|
||||
+ "a serious internal problem while trying to communicate with OSS, "
|
||||
+ "such as not being able to access the network.");
|
||||
System.out.println("Error Message:" + ce.getMessage());
|
||||
} finally {
|
||||
if (ossClient != null) {
|
||||
ossClient.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
//文件访问路径规则 https://BucketName.Endpoint/ObjectName
|
||||
StringBuilder stringBuilder = new StringBuilder("https://");
|
||||
stringBuilder
|
||||
.append(bucketName)
|
||||
.append(".")
|
||||
.append(endpoint)
|
||||
.append("/")
|
||||
.append(objectName);
|
||||
|
||||
log.info("文件上传到:{}", stringBuilder.toString());
|
||||
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,179 @@
|
||||
package com.sky.utils;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Http工具类
|
||||
*/
|
||||
public class HttpClientUtil {
|
||||
|
||||
static final int TIMEOUT_MSEC = 5 * 1000;
|
||||
|
||||
/**
|
||||
* 发送GET方式请求
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
*/
|
||||
public static String doGet(String url,Map<String,String> paramMap){
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
|
||||
String result = "";
|
||||
CloseableHttpResponse response = null;
|
||||
|
||||
try{
|
||||
URIBuilder builder = new URIBuilder(url);
|
||||
if(paramMap != null){
|
||||
for (String key : paramMap.keySet()) {
|
||||
builder.addParameter(key,paramMap.get(key));
|
||||
}
|
||||
}
|
||||
URI uri = builder.build();
|
||||
|
||||
//创建GET请求
|
||||
HttpGet httpGet = new HttpGet(uri);
|
||||
|
||||
//发送请求
|
||||
response = httpClient.execute(httpGet);
|
||||
|
||||
//判断响应状态
|
||||
if(response.getStatusLine().getStatusCode() == 200){
|
||||
result = EntityUtils.toString(response.getEntity(),"UTF-8");
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
try {
|
||||
response.close();
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送POST方式请求
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String doPost(String url, Map<String, String> paramMap) throws IOException {
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse response = null;
|
||||
String resultString = "";
|
||||
|
||||
try {
|
||||
// 创建Http Post请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
// 创建参数列表
|
||||
if (paramMap != null) {
|
||||
List<NameValuePair> paramList = new ArrayList();
|
||||
for (Map.Entry<String, String> param : paramMap.entrySet()) {
|
||||
paramList.add(new BasicNameValuePair(param.getKey(), param.getValue()));
|
||||
}
|
||||
// 模拟表单
|
||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(paramList);
|
||||
httpPost.setEntity(entity);
|
||||
}
|
||||
|
||||
httpPost.setConfig(builderRequestConfig());
|
||||
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送POST方式请求
|
||||
* @param url
|
||||
* @param paramMap
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
public static String doPost4Json(String url, Map<String, String> paramMap) throws IOException {
|
||||
// 创建Httpclient对象
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse response = null;
|
||||
String resultString = "";
|
||||
|
||||
try {
|
||||
// 创建Http Post请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
if (paramMap != null) {
|
||||
//构造json格式数据
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Map.Entry<String, String> param : paramMap.entrySet()) {
|
||||
jsonObject.put(param.getKey(),param.getValue());
|
||||
}
|
||||
StringEntity entity = new StringEntity(jsonObject.toString(),"utf-8");
|
||||
//设置请求编码
|
||||
entity.setContentEncoding("utf-8");
|
||||
//设置数据类型
|
||||
entity.setContentType("application/json");
|
||||
httpPost.setEntity(entity);
|
||||
}
|
||||
|
||||
httpPost.setConfig(builderRequestConfig());
|
||||
|
||||
// 执行http请求
|
||||
response = httpClient.execute(httpPost);
|
||||
|
||||
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
response.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
return resultString;
|
||||
}
|
||||
private static RequestConfig builderRequestConfig() {
|
||||
return RequestConfig.custom()
|
||||
.setConnectTimeout(TIMEOUT_MSEC)
|
||||
.setConnectionRequestTimeout(TIMEOUT_MSEC)
|
||||
.setSocketTimeout(TIMEOUT_MSEC).build();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<parent>
|
||||
<artifactId>sky-take-out</artifactId>
|
||||
<groupId>com.sky</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>sky-pojo</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@ -0,0 +1,22 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CategoryDTO implements Serializable {
|
||||
|
||||
//主键
|
||||
private Long id;
|
||||
|
||||
//类型 1 菜品分类 2 套餐分类
|
||||
private Integer type;
|
||||
|
||||
//分类名称
|
||||
private String name;
|
||||
|
||||
//排序
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CategoryPageQueryDTO implements Serializable {
|
||||
|
||||
//页码
|
||||
private int page;
|
||||
|
||||
//每页记录数
|
||||
private int pageSize;
|
||||
|
||||
//分类名称
|
||||
private String name;
|
||||
|
||||
//分类类型 1菜品分类 2套餐分类
|
||||
private Integer type;
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.sky.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,29 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import com.sky.entity.DishFlavor;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
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,22 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
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,22 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
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,19 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "员工登录时传递的数据模型")
|
||||
public class EmployeeLoginDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty("用户名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class EmployeePageQueryDTO implements Serializable {
|
||||
|
||||
//员工姓名
|
||||
private String name;
|
||||
|
||||
//页码
|
||||
private int page;
|
||||
|
||||
//每页显示记录数
|
||||
private int pageSize;
|
||||
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.sky.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,14 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OrdersCancelDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
//订单取消原因
|
||||
private String cancelReason;
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OrdersConfirmDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
//订单状态 1待付款 2待接单 3 已接单 4 派送中 5 已完成 6 已取消 7 退款
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
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,14 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OrdersPaymentDTO implements Serializable {
|
||||
//订单号
|
||||
private String orderNumber;
|
||||
|
||||
//付款方式
|
||||
private Integer payMethod;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class OrdersRejectionDTO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
//订单拒绝原因
|
||||
private String rejectionReason;
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
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.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PasswordEditDTO implements Serializable {
|
||||
|
||||
//员工id
|
||||
private Long empId;
|
||||
|
||||
//旧密码
|
||||
private String oldPassword;
|
||||
|
||||
//新密码
|
||||
private String newPassword;
|
||||
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import com.sky.entity.SetmealDish;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
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,22 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
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,13 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class ShoppingCartDTO implements Serializable {
|
||||
|
||||
private Long dishId;
|
||||
private Long setmealId;
|
||||
private String dishFlavor;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.sky.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* C端用户登录
|
||||
*/
|
||||
@Data
|
||||
public class UserLoginDTO implements Serializable {
|
||||
|
||||
private String code;
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.sky.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,43 @@
|
||||
package com.sky.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,50 @@
|
||||
package com.sky.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.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.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
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;
|
||||
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.sky.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,49 @@
|
||||
package com.sky.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.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.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,42 @@
|
||||
package com.sky.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
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.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.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.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,41 @@
|
||||
package com.sky.vo;
|
||||
|
||||
import com.sky.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.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.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,19 @@
|
||||
package com.sky.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,16 @@
|
||||
package com.sky.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.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,22 @@
|
||||
package com.sky.vo;
|
||||
|
||||
import com.sky.entity.OrderDetail;
|
||||
import com.sky.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,23 @@
|
||||
package com.sky.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,48 @@
|
||||
package com.sky.vo;
|
||||
|
||||
import com.sky.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.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,129 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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">
|
||||
<parent>
|
||||
<artifactId>sky-take-out</artifactId>
|
||||
<groupId>com.sky</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>sky-server</artifactId>
|
||||
<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>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
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 //开启注解方式的事务管理
|
||||
@Slf4j
|
||||
@EnableCaching//开发缓存注解功能
|
||||
@EnableScheduling //开启任务调度
|
||||
public class SkyApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SkyApplication.class, args);
|
||||
log.info("server started");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.sky.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class RedisConfiguration {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory){
|
||||
log.info("开始创建redis模板对象...");
|
||||
RedisTemplate redisTemplate = new RedisTemplate();
|
||||
//设置redis的连接工厂对象
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
//设置redis key的序列化器
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
return redisTemplate;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.dto.CategoryDTO;
|
||||
import com.sky.dto.CategoryPageQueryDTO;
|
||||
import com.sky.entity.Category;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.service.CategoryService;
|
||||
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.List;
|
||||
|
||||
/**
|
||||
* 分类管理
|
||||
*/
|
||||
@RestController //响应数据
|
||||
@RequestMapping("/admin/category") //路径
|
||||
@Api(tags = "分类相关接口") //描述
|
||||
@Slf4j //日志
|
||||
public class CategoryController { //控制器
|
||||
|
||||
@Autowired //自动注入
|
||||
private CategoryService categoryService; //创建服务
|
||||
|
||||
/**
|
||||
* 新增分类
|
||||
* @param categoryDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping //请求方式
|
||||
@ApiOperation("新增分类") //描述
|
||||
public Result<String> save(@RequestBody CategoryDTO categoryDTO){ //接收数据
|
||||
log.info("新增分类:{}", categoryDTO); //日志
|
||||
categoryService.save(categoryDTO); //调用服务
|
||||
return Result.success(); //返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类分页查询
|
||||
* @param categoryPageQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page") //请求方式
|
||||
@ApiOperation("分类分页查询") //描述
|
||||
public Result<PageResult> page(CategoryPageQueryDTO categoryPageQueryDTO){ //接收数据
|
||||
log.info("分页查询:{}", categoryPageQueryDTO); //日志
|
||||
PageResult pageResult = categoryService.pageQuery(categoryPageQueryDTO); //调用服务
|
||||
return Result.success(pageResult); //返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除分类
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@DeleteMapping //请求方式
|
||||
@ApiOperation("删除分类") //描述
|
||||
public Result<String> deleteById(Long id){ //接收数据
|
||||
log.info("删除分类:{}", id); //日志
|
||||
categoryService.deleteById(id); //调用服务
|
||||
return Result.success(); //返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改分类
|
||||
* @param categoryDTO
|
||||
* @return
|
||||
*/
|
||||
@PutMapping //请求方式
|
||||
@ApiOperation("修改分类") //描述
|
||||
public Result<String> update(@RequestBody CategoryDTO categoryDTO){ //接收数据
|
||||
categoryService.update(categoryDTO); //调用服务
|
||||
return Result.success(); //返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用、禁用分类
|
||||
* @param status
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/status/{status}") //请求方式
|
||||
@ApiOperation("启用禁用分类") //描述
|
||||
public Result<String> startOrStop(@PathVariable("status") Integer status, Long id){ //接收数据
|
||||
categoryService.startOrStop(status,id); //调用服务
|
||||
return Result.success(); //返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型查询分类
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list") //请求方式
|
||||
@ApiOperation("根据类型查询分类") //描述
|
||||
public Result<List<Category>> list(Integer type){ //接收数据
|
||||
List<Category> list = categoryService.list(type); //调用服务
|
||||
return Result.success(list); //返回结果
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,53 @@
|
||||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.constant.MessageConstant;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.utils.AliOssUtil;
|
||||
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.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;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 通用接口
|
||||
*/
|
||||
@RestController // 返回json数据
|
||||
@RequestMapping("/admin/common") // 请求路径
|
||||
@Api(tags = "通用接口") // 接口分组
|
||||
@Slf4j
|
||||
public class CommonController { // 控制器
|
||||
|
||||
@Autowired // 自动注入
|
||||
private AliOssUtil aliOssUtil; // 阿里云文件上传工具类
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/upload") // 请求路径
|
||||
@ApiOperation("文件上传") // 接口描述
|
||||
public Result<String> upload(MultipartFile file){ // 上传文件
|
||||
log.info("文件上传:{}",file); // 打印原始文件名
|
||||
|
||||
try {
|
||||
String originalFilename = file.getOriginalFilename(); //原始文件名
|
||||
String extension = originalFilename.substring(originalFilename.lastIndexOf(".")); //截取原始文件名的后缀 dfdfdf.png
|
||||
String objectName = UUID.randomUUID().toString() + extension; //构造新文件名称
|
||||
|
||||
String filePath = aliOssUtil.upload(file.getBytes(), objectName); //构造新文件名称
|
||||
return Result.success(filePath); // 返回文件上传路径
|
||||
} catch (IOException e) { // 异常处理
|
||||
log.error("文件上传失败:{}", e); // 打印错误信息
|
||||
}
|
||||
|
||||
return Result.error(MessageConstant.UPLOAD_FAILED); // 上传失败
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,142 @@
|
||||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.constant.JwtClaimsConstant;
|
||||
import com.sky.dto.EmployeeDTO;
|
||||
import com.sky.dto.EmployeeLoginDTO;
|
||||
import com.sky.dto.EmployeePageQueryDTO;
|
||||
import com.sky.entity.Employee;
|
||||
import com.sky.properties.JwtProperties;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.service.EmployeeService;
|
||||
import com.sky.utils.JwtUtil;
|
||||
import com.sky.vo.EmployeeLoginVO;
|
||||
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 // 返回json数据
|
||||
@RequestMapping("/admin/employee") // 请求路径
|
||||
@Slf4j // 日志
|
||||
@Api(tags = "员工相关接口") // 接口分组
|
||||
public class EmployeeController { // 控制器
|
||||
|
||||
@Autowired // 自动注入
|
||||
private EmployeeService employeeService; // 服务类
|
||||
@Autowired // 自动注入
|
||||
private JwtProperties jwtProperties; // jwt配置类
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*
|
||||
* @param employeeLoginDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/login") // 请求路径
|
||||
@ApiOperation(value = "员工登录") // 接口描述
|
||||
public Result<EmployeeLoginVO> login(@RequestBody EmployeeLoginDTO employeeLoginDTO) { // 接收数据
|
||||
log.info("员工登录:{}", employeeLoginDTO); // 日志
|
||||
|
||||
Employee employee = employeeService.login(employeeLoginDTO); // 调用服务类
|
||||
|
||||
Map<String, Object> claims = new HashMap<>(); // 创建jwt令牌
|
||||
claims.put(JwtClaimsConstant.EMP_ID, employee.getId()); // 添加员工id
|
||||
String token = JwtUtil.createJWT( // 创建jwt令牌
|
||||
jwtProperties.getAdminSecretKey(), // 密钥
|
||||
jwtProperties.getAdminTtl(), // 过期时间
|
||||
claims); // 添加jwt令牌
|
||||
|
||||
EmployeeLoginVO employeeLoginVO = EmployeeLoginVO.builder() // 创建员工登录信息
|
||||
.id(employee.getId()) // 员工id
|
||||
.userName(employee.getUsername()) // 用户名
|
||||
.name(employee.getName()) // 姓名
|
||||
.token(token) // jwt令牌
|
||||
.build(); // 创建员工登录信息
|
||||
|
||||
return Result.success(employeeLoginVO); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/logout") // 请求路径
|
||||
@ApiOperation("员工退出") // 接口描述
|
||||
public Result<String> logout() {
|
||||
return Result.success();
|
||||
} // 返回结果
|
||||
|
||||
/**
|
||||
* 新增员工
|
||||
* @param employeeDTO
|
||||
* @return
|
||||
*/
|
||||
@PostMapping // 请求方式
|
||||
@ApiOperation("新增员工") // 描述
|
||||
public Result save(@RequestBody EmployeeDTO employeeDTO){ // 接收数据
|
||||
log.info("新增员工:{}",employeeDTO); // 日志
|
||||
employeeService.save(employeeDTO); // 调用服务
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工分页查询
|
||||
* @param employeePageQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page") // 请求方式
|
||||
@ApiOperation("员工分页查询") // 接口描述
|
||||
public Result<PageResult> page(EmployeePageQueryDTO employeePageQueryDTO){ // 接收数据
|
||||
log.info("员工分页查询,参数为:{}", employeePageQueryDTO); // 日志
|
||||
PageResult pageResult = employeeService.pageQuery(employeePageQueryDTO); // 调用服务
|
||||
return Result.success(pageResult); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用禁用员工账号
|
||||
* @param status
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/status/{status}") // 请求方式
|
||||
@ApiOperation("启用禁用员工账号") // 接口描述
|
||||
public Result startOrStop(@PathVariable Integer status,Long id){ // 接收数据
|
||||
log.info("启用禁用员工账号:{},{}",status,id); // 日志
|
||||
employeeService.startOrStop(status,id); // 调用服务
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/{id}") // 请求方式
|
||||
@ApiOperation("根据id查询员工信息") // 描述
|
||||
public Result<Employee> getById(@PathVariable Long id){ // 接收数据
|
||||
Employee employee = employeeService.getById(id); // 调用服务
|
||||
return Result.success(employee); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑员工信息
|
||||
* @param employeeDTO
|
||||
* @return
|
||||
*/
|
||||
@PutMapping // 请求方式
|
||||
@ApiOperation("编辑员工信息") // 描述
|
||||
public Result update(@RequestBody EmployeeDTO employeeDTO){ // 接收数据
|
||||
log.info("编辑员工信息:{}", employeeDTO); // 日志
|
||||
employeeService.update(employeeDTO); // 调用服务
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,127 @@
|
||||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.dto.OrdersCancelDTO;
|
||||
import com.sky.dto.OrdersConfirmDTO;
|
||||
import com.sky.dto.OrdersPageQueryDTO;
|
||||
import com.sky.dto.OrdersRejectionDTO;
|
||||
import com.sky.result.PageResult;
|
||||
import com.sky.result.Result;
|
||||
import com.sky.service.OrderService;
|
||||
import com.sky.vo.OrderStatisticsVO;
|
||||
import com.sky.vo.OrderVO;
|
||||
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 /// 自动注入
|
||||
private OrderService orderService; // 订单服务
|
||||
|
||||
/**
|
||||
* 订单搜索
|
||||
*
|
||||
* @param ordersPageQueryDTO
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/conditionSearch") // Get请求
|
||||
@ApiOperation("订单搜索") // 接口描述
|
||||
public Result<PageResult> conditionSearch(OrdersPageQueryDTO ordersPageQueryDTO) { // 接收数据
|
||||
PageResult pageResult = orderService.conditionSearch(ordersPageQueryDTO); // 调用service层方法
|
||||
return Result.success(pageResult); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 各个状态的订单数量统计
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/statistics") // Get请求
|
||||
@ApiOperation("各个状态的订单数量统计") // 接口描述
|
||||
public Result<OrderStatisticsVO> statistics() { // 调用service层方法
|
||||
OrderStatisticsVO orderStatisticsVO = orderService.statistics(); // 调用service层方法
|
||||
return Result.success(orderStatisticsVO); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/details/{id}") // Get请求
|
||||
@ApiOperation("查询订单详情") // 描述接口
|
||||
public Result<OrderVO> details(@PathVariable("id") Long id) { // 接收数据
|
||||
OrderVO orderVO = orderService.details(id); // 调用service层方法
|
||||
return Result.success(orderVO); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/confirm") // Put请求
|
||||
@ApiOperation("接单") // 描述接口
|
||||
public Result confirm(@RequestBody OrdersConfirmDTO ordersConfirmDTO) { // 接收数据
|
||||
orderService.confirm(ordersConfirmDTO); // 调用service层方法
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/rejection") // Put请求
|
||||
@ApiOperation("拒单") // 描述接口
|
||||
public Result rejection(@RequestBody OrdersRejectionDTO ordersRejectionDTO) throws Exception { // 接收数据
|
||||
orderService.rejection(ordersRejectionDTO); // 调用service层方法
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/cancel") // Put请求
|
||||
@ApiOperation("取消订单") // 接口描述
|
||||
public Result cancel(@RequestBody OrdersCancelDTO ordersCancelDTO) throws Exception { // 接收数据
|
||||
orderService.cancel(ordersCancelDTO); // 调用service层方法
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 派送订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/delivery/{id}") // Put请求
|
||||
@ApiOperation("派送订单") // 接口描述
|
||||
public Result delivery(@PathVariable("id") Long id) { // 接收数据
|
||||
orderService.delivery(id); // 调用service层方法
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成订单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/complete/{id}") // Put请求
|
||||
@ApiOperation("完成订单") // 接口描述
|
||||
public Result complete(@PathVariable("id") Long id) { // 接收数据
|
||||
orderService.complete(id); // 调用service层方法
|
||||
return Result.success(); // 返回结果
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue