commit 6484af8cd2640579adc8d7c70ca7809a5e5115b7
Author: life <1733802689@qq.com>
Date: Thu Nov 2 22:06:52 2023 +0800
SpringBoot简单酒店初始化
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..73f69e0
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..f4784a0
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..b4f9a48
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..6560a98
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
new file mode 100644
index 0000000..5a2f139
--- /dev/null
+++ b/.idea/jarRepositories.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..88aa9a7
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml
new file mode 100644
index 0000000..e96534f
--- /dev/null
+++ b/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Finish.iml b/Finish.iml
new file mode 100644
index 0000000..78b2cc5
--- /dev/null
+++ b/Finish.iml
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/auth/pom.xml b/auth/pom.xml
new file mode 100644
index 0000000..eda9963
--- /dev/null
+++ b/auth/pom.xml
@@ -0,0 +1,33 @@
+
+
+
+ Finish
+ com.wzx
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ auth
+
+
+
+ com.wzx
+ common
+ 1.0-SNAPSHOT
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
diff --git a/auth/src/main/java/com/bwie/auth/AuthApp.java b/auth/src/main/java/com/bwie/auth/AuthApp.java
new file mode 100644
index 0000000..061e21c
--- /dev/null
+++ b/auth/src/main/java/com/bwie/auth/AuthApp.java
@@ -0,0 +1,14 @@
+package com.bwie.auth;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.scheduling.annotation.EnableScheduling;
+
+@SpringBootApplication
+@EnableFeignClients
+public class AuthApp {
+ public static void main(String[] args) {
+ SpringApplication.run(AuthApp.class);
+ }
+}
diff --git a/auth/src/main/java/com/bwie/auth/controller/AuthController.java b/auth/src/main/java/com/bwie/auth/controller/AuthController.java
new file mode 100644
index 0000000..3d83914
--- /dev/null
+++ b/auth/src/main/java/com/bwie/auth/controller/AuthController.java
@@ -0,0 +1,49 @@
+package com.bwie.auth.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.bwie.auth.service.AuthService;
+import com.bwie.common.domain.User;
+import com.bwie.common.domain.request.RequestUser;
+import com.bwie.common.domain.response.ResponseUser;
+import com.bwie.common.result.Result;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+@Log4j2
+public class AuthController {
+
+ @Autowired
+ private AuthService authService;
+
+ @Autowired
+ private HttpServletRequest request;
+
+ /**
+ * 登录认证
+ * @param requestUser
+ * @return
+ */
+ @PostMapping("/login")
+ public Result login(@RequestBody RequestUser requestUser){
+ log.info("功能名称:登录认证,请求URI:{},请求方式:{},请求参数:{}",request.getRequestURI(),
+ request.getMethod(), JSONObject.toJSONString(requestUser));
+ Result result=authService.login(requestUser);
+ log.info("功能名称:登录认证,请求URI:{},请求方式:{},返回结果:{}",request.getRequestURI(),
+ request.getMethod(), JSONObject.toJSONString(result));
+ return result;
+ }
+
+ @GetMapping("/user/info")
+ public Result userInfo(){
+ Result result=authService.userInfo();
+ return result;
+ }
+
+}
diff --git a/auth/src/main/java/com/bwie/auth/feign/AuthFeign.java b/auth/src/main/java/com/bwie/auth/feign/AuthFeign.java
new file mode 100644
index 0000000..1c43136
--- /dev/null
+++ b/auth/src/main/java/com/bwie/auth/feign/AuthFeign.java
@@ -0,0 +1,19 @@
+package com.bwie.auth.feign;
+
+import com.bwie.common.domain.User;
+import com.bwie.common.domain.request.RequestUser;
+import com.bwie.common.result.Result;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@FeignClient("system")
+public interface AuthFeign {
+ /**
+ * 根据账号密码查询用户信息
+ * @param requestUser
+ * @return
+ */
+ @PostMapping("/user/findByRequestUser")
+ public Result findByRequestUser(@RequestBody RequestUser requestUser);
+}
diff --git a/auth/src/main/java/com/bwie/auth/service/AuthService.java b/auth/src/main/java/com/bwie/auth/service/AuthService.java
new file mode 100644
index 0000000..d151036
--- /dev/null
+++ b/auth/src/main/java/com/bwie/auth/service/AuthService.java
@@ -0,0 +1,13 @@
+package com.bwie.auth.service;
+
+import com.bwie.common.domain.User;
+import com.bwie.common.domain.request.RequestUser;
+import com.bwie.common.domain.response.ResponseUser;
+import com.bwie.common.result.Result;
+
+public interface AuthService {
+ Result login(RequestUser requestUser);
+
+ Result userInfo();
+
+}
diff --git a/auth/src/main/java/com/bwie/auth/service/Impl/AuthServiceImpl.java b/auth/src/main/java/com/bwie/auth/service/Impl/AuthServiceImpl.java
new file mode 100644
index 0000000..bec4a4c
--- /dev/null
+++ b/auth/src/main/java/com/bwie/auth/service/Impl/AuthServiceImpl.java
@@ -0,0 +1,83 @@
+package com.bwie.auth.service.Impl;
+
+import com.alibaba.fastjson.JSONObject;
+
+import com.bwie.auth.feign.AuthFeign;
+import com.bwie.auth.service.AuthService;
+import com.bwie.common.constants.JwtConstants;
+import com.bwie.common.constants.TokenConstants;
+import com.bwie.common.domain.User;
+import com.bwie.common.domain.request.RequestUser;
+import com.bwie.common.domain.response.ResponseUser;
+import com.bwie.common.result.Result;
+import com.bwie.common.utils.JwtUtils;
+import com.bwie.common.utils.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+@Service
+public class AuthServiceImpl implements AuthService {
+
+ @Autowired
+ private AuthFeign authFeign;
+
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ @Autowired
+ private HttpServletRequest request;
+
+ @Override
+ public Result login(RequestUser requestUser) {
+ //判断账号密码是否为空
+ if (StringUtils.isAnyEmpty(requestUser.getUsername(),requestUser.getPassword())){
+ return Result.error("账号密码不能为空");
+ }
+ //判断账号是否注册
+ Result byRequestUser = authFeign.findByRequestUser(requestUser);
+ User data = byRequestUser.getData();
+ if (null==data){
+ return Result.error("账号未注册");
+ }
+ //判断密码是否正确
+ String password = data.getPassword();
+ if (!password.equals(requestUser.getPassword())){
+ return Result.error("密码错误");
+ }
+ //生成userKey
+ String userKey = UUID.randomUUID().toString().replaceAll("-", "");
+ //生成token
+ HashMap map = new HashMap<>();
+ map.put(JwtConstants.DETAILS_USER_ID,data.getUserId());
+ map.put(JwtConstants.USER_KEY,userKey);
+ String token = JwtUtils.createToken(map);
+ //存入redis
+ redisTemplate.opsForValue().set(TokenConstants.LOGIN_TOKEN_KEY+userKey, JSONObject.toJSONString(data),15, TimeUnit.MINUTES);
+ //赋值
+ ResponseUser responseUser = new ResponseUser();
+ responseUser.setToken(token);
+ responseUser.setExprieTime("15MIN");
+
+ return Result.success(responseUser);
+ }
+
+ @Override
+ public Result userInfo() {
+ //获取token
+ String token = request.getHeader(TokenConstants.TOKEN);
+ //获取userKey
+ String userKey = JwtUtils.getUserKey(token);
+ //获取用户信息
+ String s = redisTemplate.opsForValue().get(TokenConstants.LOGIN_TOKEN_KEY + userKey);
+ //反序列化
+ User user= JSONObject.parseObject(s, User.class);
+
+ return Result.success(user);
+ }
+}
diff --git a/auth/src/main/resources/bootstrap.yml b/auth/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..5e6b042
--- /dev/null
+++ b/auth/src/main/resources/bootstrap.yml
@@ -0,0 +1,32 @@
+# Tomcat
+server:
+ port: 9001
+# Spring
+spring:
+ main:
+ allow-circular-references: true
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: GMT+8
+ application:
+ # 应用名称
+ name: auth
+ profiles:
+ # 环境配置
+ active: dev
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: 124.221.214.183:8848
+ namespace: lc
+ config:
+ # 配置中心地址
+ server-addr: 124.221.214.183:8848
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
+ namespace: lc
+
diff --git a/auth/target/auth-1.0-SNAPSHOT.jar b/auth/target/auth-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..9a6120e
Binary files /dev/null and b/auth/target/auth-1.0-SNAPSHOT.jar differ
diff --git a/auth/target/classes/bootstrap.yml b/auth/target/classes/bootstrap.yml
new file mode 100644
index 0000000..5e6b042
--- /dev/null
+++ b/auth/target/classes/bootstrap.yml
@@ -0,0 +1,32 @@
+# Tomcat
+server:
+ port: 9001
+# Spring
+spring:
+ main:
+ allow-circular-references: true
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: GMT+8
+ application:
+ # 应用名称
+ name: auth
+ profiles:
+ # 环境配置
+ active: dev
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: 124.221.214.183:8848
+ namespace: lc
+ config:
+ # 配置中心地址
+ server-addr: 124.221.214.183:8848
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
+ namespace: lc
+
diff --git a/auth/target/classes/com/bwie/auth/AuthApp.class b/auth/target/classes/com/bwie/auth/AuthApp.class
new file mode 100644
index 0000000..b1fbefd
Binary files /dev/null and b/auth/target/classes/com/bwie/auth/AuthApp.class differ
diff --git a/auth/target/classes/com/bwie/auth/controller/AuthController.class b/auth/target/classes/com/bwie/auth/controller/AuthController.class
new file mode 100644
index 0000000..0e124fe
Binary files /dev/null and b/auth/target/classes/com/bwie/auth/controller/AuthController.class differ
diff --git a/auth/target/classes/com/bwie/auth/feign/AuthFeign.class b/auth/target/classes/com/bwie/auth/feign/AuthFeign.class
new file mode 100644
index 0000000..831b246
Binary files /dev/null and b/auth/target/classes/com/bwie/auth/feign/AuthFeign.class differ
diff --git a/auth/target/classes/com/bwie/auth/service/AuthService.class b/auth/target/classes/com/bwie/auth/service/AuthService.class
new file mode 100644
index 0000000..72aecc9
Binary files /dev/null and b/auth/target/classes/com/bwie/auth/service/AuthService.class differ
diff --git a/auth/target/classes/com/bwie/auth/service/Impl/AuthServiceImpl.class b/auth/target/classes/com/bwie/auth/service/Impl/AuthServiceImpl.class
new file mode 100644
index 0000000..f70554e
Binary files /dev/null and b/auth/target/classes/com/bwie/auth/service/Impl/AuthServiceImpl.class differ
diff --git a/auth/target/maven-archiver/pom.properties b/auth/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..f6c78d3
--- /dev/null
+++ b/auth/target/maven-archiver/pom.properties
@@ -0,0 +1,3 @@
+artifactId=auth
+groupId=com.wzx
+version=1.0-SNAPSHOT
diff --git a/auth/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/auth/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..483722a
--- /dev/null
+++ b/auth/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,5 @@
+com\bwie\auth\feign\AuthFeign.class
+com\bwie\auth\service\Impl\AuthServiceImpl.class
+com\bwie\auth\controller\AuthController.class
+com\bwie\auth\AuthApp.class
+com\bwie\auth\service\AuthService.class
diff --git a/auth/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/auth/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..b77e70c
--- /dev/null
+++ b/auth/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,5 @@
+D:\Project\Finish\auth\src\main\java\com\bwie\auth\service\AuthService.java
+D:\Project\Finish\auth\src\main\java\com\bwie\auth\service\Impl\AuthServiceImpl.java
+D:\Project\Finish\auth\src\main\java\com\bwie\auth\feign\AuthFeign.java
+D:\Project\Finish\auth\src\main\java\com\bwie\auth\AuthApp.java
+D:\Project\Finish\auth\src\main\java\com\bwie\auth\controller\AuthController.java
diff --git a/auth/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/auth/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/auth/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/auth/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/common/pom.xml b/common/pom.xml
new file mode 100644
index 0000000..a2904f9
--- /dev/null
+++ b/common/pom.xml
@@ -0,0 +1,119 @@
+
+
+
+ Finish
+ com.wzx
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ common
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-bootstrap
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-config
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-sentinel
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-loadbalancer
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+
+ io.jsonwebtoken
+ jjwt
+ 0.9.1
+
+
+
+ com.alibaba
+ fastjson
+ 1.2.80
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+ cn.hutool
+ hutool-all
+ 5.8.3
+
+
+
+ com.aliyun
+ dysmsapi20170525
+ 2.0.1
+
+
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.2.1
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.2.1
+
+
+ commons-lang
+ commons-lang
+ 2.6
+
+
+ org.eclipse.jetty
+ jetty-util
+ 9.3.7.v20160115
+
+
+
+
+ com.github.tobato
+ fastdfs-client
+ 1.26.5
+
+
+
+
diff --git a/common/src/main/java/com/bwie/common/constants/Constants.java b/common/src/main/java/com/bwie/common/constants/Constants.java
new file mode 100644
index 0000000..2fdc9fe
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/constants/Constants.java
@@ -0,0 +1,18 @@
+package com.bwie.common.constants;
+
+/**
+ * @description: 系统常量
+ * @author DongZl
+ */
+public class Constants {
+ /**
+ * 成功标记
+ */
+ public static final Integer SUCCESS = 200;
+ public static final String SUCCESS_MSG = "操作成功";
+ /**
+ * 失败标记
+ */
+ public static final Integer ERROR = 500;
+ public static final String ERROR_MSG = "操作异常";
+}
diff --git a/common/src/main/java/com/bwie/common/constants/JwtConstants.java b/common/src/main/java/com/bwie/common/constants/JwtConstants.java
new file mode 100644
index 0000000..03692c1
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/constants/JwtConstants.java
@@ -0,0 +1,29 @@
+package com.bwie.common.constants;
+
+/**
+ * @author DongZl
+ * @description: Jwt常量
+ */
+public class JwtConstants {
+
+ /**
+ * 用户ID字段
+ */
+ public static final String DETAILS_USER_ID = "user_id";
+
+ /**
+ * 用户名字段
+ */
+ public static final String DETAILS_USERNAME = "username";
+
+ /**
+ * 用户标识
+ */
+ public static final String USER_KEY = "user_key";
+
+ /**
+ * 令牌秘钥
+ */
+ public final static String SECRET = "abcdefghijklmnopqrstuvwxyz";
+
+}
diff --git a/common/src/main/java/com/bwie/common/constants/RabbitMQConstants.java b/common/src/main/java/com/bwie/common/constants/RabbitMQConstants.java
new file mode 100644
index 0000000..ad4b095
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/constants/RabbitMQConstants.java
@@ -0,0 +1,9 @@
+package com.bwie.common.constants;
+
+/**
+ * @author WangTangDong
+ * @date 2023/7/28 20:04
+ */
+public class RabbitMQConstants {
+ public static final String SEND_CODE="send_code";
+}
diff --git a/common/src/main/java/com/bwie/common/constants/TokenConstants.java b/common/src/main/java/com/bwie/common/constants/TokenConstants.java
new file mode 100644
index 0000000..1871fb7
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/constants/TokenConstants.java
@@ -0,0 +1,24 @@
+package com.bwie.common.constants;
+
+/**
+ * @author DongZl
+ * @description: 令牌常量
+ */
+public class TokenConstants {
+ /**
+ * 缓存有效期,默认720(分钟)
+ */
+ public final static long EXPIRATION = 720;
+ /**
+ * 缓存刷新时间,默认120(分钟)
+ */
+ public final static long REFRESH_TIME = 120;
+ /**
+ * 权限缓存前缀
+ */
+ public final static String LOGIN_TOKEN_KEY = "login_tokens:";
+ /**
+ * token标识
+ */
+ public static final String TOKEN = "token";
+}
diff --git a/common/src/main/java/com/bwie/common/domain/Hotel.java b/common/src/main/java/com/bwie/common/domain/Hotel.java
new file mode 100644
index 0000000..82d7b69
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/Hotel.java
@@ -0,0 +1,15 @@
+package com.bwie.common.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class Hotel {
+ private Integer id;
+ private String name;
+ private BigDecimal price;
+ private String pic;
+ private Integer number;
+ private Integer status;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/Menu.java b/common/src/main/java/com/bwie/common/domain/Menu.java
new file mode 100644
index 0000000..49cd815
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/Menu.java
@@ -0,0 +1,13 @@
+package com.bwie.common.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class Menu {
+ private Integer menuId;
+ private String menuName;
+ private BigDecimal menuPrice;
+ private String pic;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/MyMenu.java b/common/src/main/java/com/bwie/common/domain/MyMenu.java
new file mode 100644
index 0000000..c446158
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/MyMenu.java
@@ -0,0 +1,13 @@
+package com.bwie.common.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class MyMenu {
+ private Integer myId;
+ public Integer userId;
+ public Integer menuId;
+ public BigDecimal pay;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/Order.java b/common/src/main/java/com/bwie/common/domain/Order.java
new file mode 100644
index 0000000..6e509bc
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/Order.java
@@ -0,0 +1,14 @@
+package com.bwie.common.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class Order {
+ private Integer orderId;
+ private String orderCard;
+ private String name;
+ private BigDecimal price;
+ private Integer userId;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/Stay.java b/common/src/main/java/com/bwie/common/domain/Stay.java
new file mode 100644
index 0000000..27b65c9
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/Stay.java
@@ -0,0 +1,18 @@
+package com.bwie.common.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class Stay {
+ private Integer sayId;
+ private String username;
+ private String phone;
+ private String card;
+ private String name;
+ private BigDecimal price;
+ private Integer dayNumber;
+ private BigDecimal totalPrice;
+
+}
diff --git a/common/src/main/java/com/bwie/common/domain/User.java b/common/src/main/java/com/bwie/common/domain/User.java
new file mode 100644
index 0000000..bbf00ba
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/User.java
@@ -0,0 +1,16 @@
+package com.bwie.common.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class User {
+ private Integer userId;
+ private String username;
+ private String password;
+ private String phone;
+ private BigDecimal balance;
+ private Integer roleId;
+ private String roleName;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/request/QueryHotel.java b/common/src/main/java/com/bwie/common/domain/request/QueryHotel.java
new file mode 100644
index 0000000..58baf41
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/request/QueryHotel.java
@@ -0,0 +1,16 @@
+package com.bwie.common.domain.request;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class QueryHotel {
+ //分页
+ private Integer pageNum=1;
+ private Integer pageSize=2;
+ //条件查询
+ private BigDecimal priceA;
+ private BigDecimal priceB;
+ private Integer status;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/request/RequestUser.java b/common/src/main/java/com/bwie/common/domain/request/RequestUser.java
new file mode 100644
index 0000000..f05042f
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/request/RequestUser.java
@@ -0,0 +1,9 @@
+package com.bwie.common.domain.request;
+
+import lombok.Data;
+
+@Data
+public class RequestUser {
+ private String username;
+ private String password;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/response/ResponseHotel.java b/common/src/main/java/com/bwie/common/domain/response/ResponseHotel.java
new file mode 100644
index 0000000..fbd952c
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/response/ResponseHotel.java
@@ -0,0 +1,15 @@
+package com.bwie.common.domain.response;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class ResponseHotel {
+ private Integer id;
+ private String name;
+ private BigDecimal price;
+ private String pic;
+ private Integer number;
+ private Integer status;
+}
diff --git a/common/src/main/java/com/bwie/common/domain/response/ResponseUser.java b/common/src/main/java/com/bwie/common/domain/response/ResponseUser.java
new file mode 100644
index 0000000..51b037d
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/domain/response/ResponseUser.java
@@ -0,0 +1,9 @@
+package com.bwie.common.domain.response;
+
+import lombok.Data;
+
+@Data
+public class ResponseUser {
+ private String token;
+ private String exprieTime;
+}
diff --git a/common/src/main/java/com/bwie/common/result/PageResult.java b/common/src/main/java/com/bwie/common/result/PageResult.java
new file mode 100644
index 0000000..85ecdda
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/result/PageResult.java
@@ -0,0 +1,34 @@
+package com.bwie.common.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author DongZl
+ * @description: 列表返回结果集
+ */
+@Data
+public class PageResult implements Serializable {
+ /**
+ * 总条数
+ */
+ private long total;
+ /**
+ * 结果集合
+ */
+ private List list;
+ public PageResult() {
+ }
+ public PageResult(long total, List list) {
+ this.total = total;
+ this.list = list;
+ }
+ public static PageResult toPageResult(long total, List list){
+ return new PageResult(total , list);
+ }
+ public static Result> toResult(long total, List list){
+ return Result.success(PageResult.toPageResult(total,list));
+ }
+}
diff --git a/common/src/main/java/com/bwie/common/result/Result.java b/common/src/main/java/com/bwie/common/result/Result.java
new file mode 100644
index 0000000..30b1e73
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/result/Result.java
@@ -0,0 +1,76 @@
+package com.bwie.common.result;
+
+import com.bwie.common.constants.Constants;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author DongZl
+ * @description: 响应信息主体
+ */
+@Data
+public class Result implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ /**
+ * 成功
+ */
+ public static final int SUCCESS = Constants.SUCCESS;
+ /**
+ * 失败
+ */
+ public static final int FAIL = Constants.ERROR;
+ /**
+ * 返回状态码
+ */
+ private int code;
+ /**
+ * 响应信息
+ */
+ private String msg;
+ /**
+ * 响应数据
+ */
+ private T data;
+
+ public static Result success() {
+ return restResult(null, SUCCESS, Constants.SUCCESS_MSG);
+ }
+
+ public static Result success(T data) {
+ return restResult(data, SUCCESS, Constants.SUCCESS_MSG);
+ }
+
+ public static Result success(T data, String msg) {
+ return restResult(data, SUCCESS, msg);
+ }
+
+ public static Result error() {
+ return restResult(null, FAIL, Constants.ERROR_MSG);
+ }
+
+ public static Result error(String msg) {
+ return restResult(null, FAIL, msg);
+ }
+
+ public static Result error(T data) {
+ return restResult(data, FAIL, Constants.ERROR_MSG);
+ }
+
+ public static Result error(T data, String msg) {
+ return restResult(data, FAIL, msg);
+ }
+
+ public static Result error(int code, String msg) {
+ return restResult(null, code, msg);
+ }
+
+ private static Result restResult(T data, int code, String msg) {
+ Result apiResult = new Result<>();
+ apiResult.setCode(code);
+ apiResult.setData(data);
+ apiResult.setMsg(msg);
+ return apiResult;
+ }
+}
diff --git a/common/src/main/java/com/bwie/common/utils/FastUtil.java b/common/src/main/java/com/bwie/common/utils/FastUtil.java
new file mode 100644
index 0000000..9fe9f9b
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/utils/FastUtil.java
@@ -0,0 +1,56 @@
+package com.bwie.common.utils;
+
+import org.springframework.stereotype.Component;
+import com.github.tobato.fastdfs.domain.fdfs.StorePath;
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+
+/**
+ * @BelongsProject: 0107day02
+ * @BelongsPackage: com.bw.config
+ * @Author: zhupengfei
+ * @CreateTime: 2023-02-01 08:52
+ */
+@Component
+public class FastUtil {
+ private static final Logger log = LoggerFactory.getLogger(FastUtil.class);
+
+ @Resource
+ private FastFileStorageClient storageClient ;
+
+ /**
+ * 上传文件
+ */
+ public String upload(MultipartFile multipartFile) throws Exception{
+ String originalFilename = multipartFile.getOriginalFilename().
+ substring(multipartFile.getOriginalFilename().
+ lastIndexOf(".") + 1);
+ StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage(
+ multipartFile.getInputStream(),
+ multipartFile.getSize(),originalFilename , null);
+ return storePath.getFullPath() ;
+ }
+ /**
+ * 删除文件
+ */
+ public String deleteFile(String fileUrl) {
+ if (StringUtils.isEmpty(fileUrl)) {
+ log.info("fileUrl == >>文件路径为空...");
+ return "文件路径不能为空";
+ }
+ try {
+ StorePath storePath = StorePath.parseFromUrl(fileUrl);
+ storageClient.deleteFile(storePath.getGroup(), storePath.getPath());
+ } catch (Exception e) {
+ log.error(e.getMessage());
+ }
+ return "删除成功";
+ }
+
+}
diff --git a/common/src/main/java/com/bwie/common/utils/HttpUtils.java b/common/src/main/java/com/bwie/common/utils/HttpUtils.java
new file mode 100644
index 0000000..e15968b
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/utils/HttpUtils.java
@@ -0,0 +1,319 @@
+package com.bwie.common.utils;
+
+import com.alibaba.fastjson.JSON;
+import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.entity.UrlEncodedFormEntity;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.conn.ClientConnectionManager;
+import org.apache.http.conn.scheme.Scheme;
+import org.apache.http.conn.scheme.SchemeRegistry;
+import org.apache.http.conn.ssl.SSLSocketFactory;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.message.BasicNameValuePair;
+import org.apache.http.util.EntityUtils;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public class HttpUtils {
+
+ /**
+ * get
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @return
+ * @throws Exception
+ */
+ public static List doGet(String host, String path, String method,
+ Map headers,
+ Map querys
+ ,Class clazz)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpGet request = new HttpGet(buildUrl(host, path, querys));
+ if(headers!=null){
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ }
+ HttpResponse execute = httpClient.execute(request);
+ String s = EntityUtils.toString(execute.getEntity(),"UTF-8");
+ List ts = JSON.parseArray(s, clazz);
+ return ts;
+ }
+
+ /**
+ * post form
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param bodys
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPost(String host, String path, String method,
+ Map headers,
+ Map querys,
+ Map bodys)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPost request = new HttpPost(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (bodys != null) {
+ List nameValuePairList = new ArrayList();
+
+ for (String key : bodys.keySet()) {
+ nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key)));
+ }
+ UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8");
+ formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8");
+ request.setEntity(formEntity);
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Post String
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPost(String host, String path, String method,
+ Map headers,
+ Map querys,
+ String body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPost request = new HttpPost(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (StringUtils.isNotBlank(body)) {
+ request.setEntity(new StringEntity(body, "utf-8"));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Post stream
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPost(String host, String path, String method,
+ Map headers,
+ Map querys,
+ byte[] body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPost request = new HttpPost(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (body != null) {
+ request.setEntity(new ByteArrayEntity(body));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Put String
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPut(String host, String path, String method,
+ Map headers,
+ Map querys,
+ String body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPut request = new HttpPut(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (StringUtils.isNotBlank(body)) {
+ request.setEntity(new StringEntity(body, "utf-8"));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Put stream
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @param body
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doPut(String host, String path, String method,
+ Map headers,
+ Map querys,
+ byte[] body)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpPut request = new HttpPut(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ if (body != null) {
+ request.setEntity(new ByteArrayEntity(body));
+ }
+
+ return httpClient.execute(request);
+ }
+
+ /**
+ * Delete
+ *
+ * @param host
+ * @param path
+ * @param method
+ * @param headers
+ * @param querys
+ * @return
+ * @throws Exception
+ */
+ public static HttpResponse doDelete(String host, String path, String method,
+ Map headers,
+ Map querys)
+ throws Exception {
+ HttpClient httpClient = wrapClient(host);
+
+ HttpDelete request = new HttpDelete(buildUrl(host, path, querys));
+ for (Map.Entry e : headers.entrySet()) {
+ request.addHeader(e.getKey(), e.getValue());
+ }
+
+ return httpClient.execute(request);
+ }
+
+ private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException {
+ StringBuilder sbUrl = new StringBuilder();
+ sbUrl.append(host);
+ if (!StringUtils.isBlank(path)) {
+ sbUrl.append(path);
+ }
+ if (null != querys) {
+ StringBuilder sbQuery = new StringBuilder();
+ for (Map.Entry query : querys.entrySet()) {
+ if (0 < sbQuery.length()) {
+ sbQuery.append("&");
+ }
+ if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) {
+ sbQuery.append(query.getValue());
+ }
+ if (!StringUtils.isBlank(query.getKey())) {
+ sbQuery.append(query.getKey());
+ if (!StringUtils.isBlank(query.getValue())) {
+ sbQuery.append("=");
+ sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8"));
+ }
+ }
+ }
+ if (0 < sbQuery.length()) {
+ sbUrl.append("?").append(sbQuery);
+ }
+ }
+
+ return sbUrl.toString();
+ }
+
+ private static HttpClient wrapClient(String host) {
+ HttpClient httpClient = new DefaultHttpClient();
+ if (host.startsWith("https://")) {
+ sslClient(httpClient);
+ }
+
+ return httpClient;
+ }
+
+ private static void sslClient(HttpClient httpClient) {
+ try {
+ SSLContext ctx = SSLContext.getInstance("TLS");
+ X509TrustManager tm = new X509TrustManager() {
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ public void checkClientTrusted(X509Certificate[] xcs, String str) {
+
+ }
+ public void checkServerTrusted(X509Certificate[] xcs, String str) {
+
+ }
+ };
+ ctx.init(null, new TrustManager[] { tm }, null);
+ SSLSocketFactory ssf = new SSLSocketFactory(ctx);
+ ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
+ ClientConnectionManager ccm = httpClient.getConnectionManager();
+ SchemeRegistry registry = ccm.getSchemeRegistry();
+ registry.register(new Scheme("https", 443, ssf));
+ } catch (KeyManagementException ex) {
+ throw new RuntimeException(ex);
+ } catch (NoSuchAlgorithmException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+}
\ No newline at end of file
diff --git a/common/src/main/java/com/bwie/common/utils/JwtUtils.java b/common/src/main/java/com/bwie/common/utils/JwtUtils.java
new file mode 100644
index 0000000..f560aa9
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/utils/JwtUtils.java
@@ -0,0 +1,109 @@
+package com.bwie.common.utils;
+
+import com.bwie.common.constants.JwtConstants;
+import io.jsonwebtoken.Claims;
+import io.jsonwebtoken.Jwts;
+import io.jsonwebtoken.SignatureAlgorithm;
+
+import java.util.Map;
+
+/**
+ * @description: Jwt工具类
+ * @author DongZl
+ */
+public class JwtUtils {
+
+ /**
+ * 秘钥
+ */
+ public static String secret = JwtConstants.SECRET;
+
+ /**
+ * 从数据声明生成令牌
+ *
+ * @param claims 数据声明
+ * @return 令牌
+ */
+ public static String createToken(Map claims){
+ String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
+ return token;
+ }
+
+ /**
+ * 从令牌中获取数据声明
+ *
+ * @param token 令牌
+ * @return 数据声明
+ */
+ public static Claims parseToken(String token){
+ return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
+ }
+ /**
+ * 根据令牌获取用户标识
+ *
+ * @param token 令牌
+ * @return 用户ID
+ */
+ public static String getUserKey(String token){
+ Claims claims = parseToken(token);
+ return getValue(claims, JwtConstants.USER_KEY);
+ }
+ /**
+ * 根据令牌获取用户标识
+ *
+ * @param claims 身份信息
+ * @return 用户ID
+ */
+ public static String getUserKey(Claims claims){
+ return getValue(claims, JwtConstants.USER_KEY);
+ }
+ /**
+ * 根据令牌获取用户ID
+ *
+ * @param token 令牌
+ * @return 用户ID
+ */
+ public static String getUserId(String token){
+ Claims claims = parseToken(token);
+ return getValue(claims, JwtConstants.DETAILS_USER_ID);
+ }
+ /**
+ * 根据身份信息获取用户ID
+ *
+ * @param claims 身份信息
+ * @return 用户ID
+ */
+ public static String getUserId(Claims claims){
+ return getValue(claims, JwtConstants.DETAILS_USER_ID);
+ }
+ /**
+ * 根据令牌获取用户名
+ *
+ * @param token 令牌
+ * @return 用户名
+ */
+ public static String getUserName(String token){
+ Claims claims = parseToken(token);
+ return getValue(claims, JwtConstants.DETAILS_USERNAME);
+ }
+ /**
+ * 根据身份信息获取用户名
+ *
+ * @param claims 身份信息
+ * @return 用户名
+ */
+ public static String getUserName(Claims claims){
+ return getValue(claims, JwtConstants.DETAILS_USERNAME);
+ }
+ /**
+ * 根据身份信息获取键值
+ *
+ * @param claims 身份信息
+ * @param key 键
+ * @return 值
+ */
+ public static String getValue(Claims claims, String key){
+ Object obj = claims.get(key);
+ return obj == null ? "" : obj.toString();
+ }
+}
diff --git a/common/src/main/java/com/bwie/common/utils/MsgUtil.java b/common/src/main/java/com/bwie/common/utils/MsgUtil.java
new file mode 100644
index 0000000..e672bc1
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/utils/MsgUtil.java
@@ -0,0 +1,58 @@
+package com.bwie.common.utils;
+
+
+import org.apache.http.HttpResponse;
+import org.apache.http.util.EntityUtils;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Component;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author
+ * @version 1.0.0
+ * @ClassName MsgUtil.java
+ * @Description TODO
+ * @createTime 2022年05月26日 15:49:00
+ */
+public class MsgUtil {
+
+
+ public static void sendMsg(String phone,String code){
+ String host = "https://gyytz.market.alicloudapi.com";
+ String path = "/sms/smsSend";
+ String method = "POST";
+ String appcode = "d742f8e74e03432f92eec7267b919ee";
+ Map headers = new HashMap();
+ //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105
+ headers.put("Authorization", "APPCODE " + appcode);
+ Map querys = new HashMap();
+ querys.put("mobile", phone);
+ querys.put("param", "**code**:"+code+",**minute**:5");
+
+//smsSignId(短信前缀)和templateId(短信模板),可登录国阳云控制台自助申请。参考文档:http://help.guoyangyun.com/Problem/Qm.html
+
+ querys.put("smsSignId", "2e65b1bb3d054466b82f0c9d125465e2");
+ querys.put("templateId", "908e94ccf08b4476ba6c876d13f084ad");
+ Map bodys = new HashMap();
+
+
+ try {
+ /**
+ * 重要提示如下:
+ * HttpUtils请从\r\n\t \t* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java\r\n\t \t* 下载
+ *
+ * 相应的依赖请参照
+ * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml
+ */
+ HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
+ System.out.println(response.toString());
+ //获取response的body
+ System.out.println(EntityUtils.toString(response.getEntity()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/common/src/main/java/com/bwie/common/utils/StringUtils.java b/common/src/main/java/com/bwie/common/utils/StringUtils.java
new file mode 100644
index 0000000..93c47fd
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/utils/StringUtils.java
@@ -0,0 +1,68 @@
+package com.bwie.common.utils;
+
+import org.springframework.util.AntPathMatcher;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author DongZl
+ * @description: 字符串处理工具类
+ */
+public class StringUtils extends org.apache.commons.lang3.StringUtils {
+
+ /**
+ * * 判断一个对象是否为空
+ *
+ * @param object Object
+ * @return true:为空 false:非空
+ */
+ public static boolean isNull(Object object) {
+ return object == null;
+ }
+
+ /**
+ * * 判断一个Collection是否为空, 包含List,Set,Queue
+ *
+ * @param coll 要判断的Collection
+ * @return true:为空 false:非空
+ */
+ public static boolean isEmpty(Collection> coll) {
+ return isNull(coll) || coll.isEmpty();
+ }
+
+ /**
+ * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串
+ *
+ * @param str 指定字符串
+ * @param strs 需要检查的字符串数组
+ * @return 是否匹配
+ */
+ public static boolean matches(String str, List strs) {
+ if (isEmpty(str) || isEmpty(strs)) {
+ return false;
+ }
+ for (String pattern : strs) {
+ if (isMatch(pattern, str))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 判断url是否与规则配置:
+ * ? 表示单个字符;
+ * * 表示一层路径内的任意字符串,不可跨层级;
+ * ** 表示任意层路径;
+ *
+ * @param pattern 匹配规则
+ * @param url 需要匹配的url
+ * @return
+ */
+ public static boolean isMatch(String pattern, String url) {
+ AntPathMatcher matcher = new AntPathMatcher();
+ return matcher.match(pattern, url);
+ }
+}
diff --git a/common/src/main/java/com/bwie/common/utils/TelSmsUtils.java b/common/src/main/java/com/bwie/common/utils/TelSmsUtils.java
new file mode 100644
index 0000000..49e8c81
--- /dev/null
+++ b/common/src/main/java/com/bwie/common/utils/TelSmsUtils.java
@@ -0,0 +1,87 @@
+package com.bwie.common.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.aliyun.dysmsapi20170525.Client;
+import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
+import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
+import com.aliyun.teaopenapi.models.Config;
+import lombok.extern.log4j.Log4j2;
+
+import java.util.Map;
+
+/**
+ * 短信工具类
+ */
+@Log4j2
+public class TelSmsUtils {
+
+ /**
+ * 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限
+ */
+ private static String accessKeyId = "LTAIEVXszCmcd1T5";
+ private static String accessKeySecret = "2zHwciQXln8wExSEnkIYtRTSwLeRNd";
+
+ /**
+ * 短信访问域名
+ */
+ private static String endpoint = "dysmsapi.aliyuncs.com";
+ /**
+ * 短信签名
+ */
+ private static String signName = "登录验证";
+
+ /**
+ * 实例化短信对象
+ */
+ private static Client client;
+
+ static {
+ log.info("初始化短信服务开始");
+ long startTime = System.currentTimeMillis();
+ try {
+ client = initClient();
+ log.info("初始化短信成功:{}",signName);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ log.info("初始化短信服务结束:耗时:{}MS",(System.currentTimeMillis()-startTime));
+ }
+ /**
+ * 初始化短信对象
+ * @return
+ * @throws Exception
+ */
+ private static Client initClient() throws Exception{
+ Config config = new Config()
+ // 您的AccessKey ID
+ .setAccessKeyId(accessKeyId)
+ // 您的AccessKey Secret
+ .setAccessKeySecret(accessKeySecret);
+ // 访问的域名
+ config.endpoint = endpoint;
+ return new Client(config);
+ }
+
+ /**
+ * 发送单条短信
+ * @param tel
+ * @param templateCode SMS_153991546
+ * @param sendDataMap
+ */
+ public static String sendSms(String tel , String templateCode , Map sendDataMap){
+ SendSmsRequest sendSmsRequest = new SendSmsRequest()
+ .setPhoneNumbers(tel)
+ .setSignName(signName)
+ .setTemplateCode(templateCode)
+ .setTemplateParam(JSONObject.toJSONString(sendDataMap));
+ SendSmsResponse sendSmsResponse = null;
+ try {
+ log.info("发送短信验证码:消息内容是:【{}】", JSONObject.toJSONString(sendDataMap));
+ sendSmsResponse = client.sendSms(sendSmsRequest);
+ } catch (Exception e) {
+ log.error("短信发送异常,手机号:【{}】,短信内容:【{}】,异常信息:【{}】", tel, sendDataMap, e);
+ }
+ return JSONObject.toJSONString(sendSmsResponse.getBody());
+ }
+
+}
diff --git a/common/target/classes/com/bwie/common/constants/Constants.class b/common/target/classes/com/bwie/common/constants/Constants.class
new file mode 100644
index 0000000..a46a3e2
Binary files /dev/null and b/common/target/classes/com/bwie/common/constants/Constants.class differ
diff --git a/common/target/classes/com/bwie/common/constants/JwtConstants.class b/common/target/classes/com/bwie/common/constants/JwtConstants.class
new file mode 100644
index 0000000..3ff632f
Binary files /dev/null and b/common/target/classes/com/bwie/common/constants/JwtConstants.class differ
diff --git a/common/target/classes/com/bwie/common/constants/RabbitMQConstants.class b/common/target/classes/com/bwie/common/constants/RabbitMQConstants.class
new file mode 100644
index 0000000..dd3e07b
Binary files /dev/null and b/common/target/classes/com/bwie/common/constants/RabbitMQConstants.class differ
diff --git a/common/target/classes/com/bwie/common/constants/TokenConstants.class b/common/target/classes/com/bwie/common/constants/TokenConstants.class
new file mode 100644
index 0000000..725bfe5
Binary files /dev/null and b/common/target/classes/com/bwie/common/constants/TokenConstants.class differ
diff --git a/common/target/classes/com/bwie/common/domain/Hotel.class b/common/target/classes/com/bwie/common/domain/Hotel.class
new file mode 100644
index 0000000..34402e4
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/Hotel.class differ
diff --git a/common/target/classes/com/bwie/common/domain/Menu.class b/common/target/classes/com/bwie/common/domain/Menu.class
new file mode 100644
index 0000000..d07e083
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/Menu.class differ
diff --git a/common/target/classes/com/bwie/common/domain/MyMenu.class b/common/target/classes/com/bwie/common/domain/MyMenu.class
new file mode 100644
index 0000000..602ef45
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/MyMenu.class differ
diff --git a/common/target/classes/com/bwie/common/domain/Order.class b/common/target/classes/com/bwie/common/domain/Order.class
new file mode 100644
index 0000000..85fb0bd
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/Order.class differ
diff --git a/common/target/classes/com/bwie/common/domain/Stay.class b/common/target/classes/com/bwie/common/domain/Stay.class
new file mode 100644
index 0000000..4dc787d
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/Stay.class differ
diff --git a/common/target/classes/com/bwie/common/domain/User.class b/common/target/classes/com/bwie/common/domain/User.class
new file mode 100644
index 0000000..169e852
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/User.class differ
diff --git a/common/target/classes/com/bwie/common/domain/request/QueryHotel.class b/common/target/classes/com/bwie/common/domain/request/QueryHotel.class
new file mode 100644
index 0000000..9a1396d
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/request/QueryHotel.class differ
diff --git a/common/target/classes/com/bwie/common/domain/request/RequestUser.class b/common/target/classes/com/bwie/common/domain/request/RequestUser.class
new file mode 100644
index 0000000..3edea42
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/request/RequestUser.class differ
diff --git a/common/target/classes/com/bwie/common/domain/response/ResponseHotel.class b/common/target/classes/com/bwie/common/domain/response/ResponseHotel.class
new file mode 100644
index 0000000..8f8510b
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/response/ResponseHotel.class differ
diff --git a/common/target/classes/com/bwie/common/domain/response/ResponseUser.class b/common/target/classes/com/bwie/common/domain/response/ResponseUser.class
new file mode 100644
index 0000000..4e29fdf
Binary files /dev/null and b/common/target/classes/com/bwie/common/domain/response/ResponseUser.class differ
diff --git a/common/target/classes/com/bwie/common/result/PageResult.class b/common/target/classes/com/bwie/common/result/PageResult.class
new file mode 100644
index 0000000..60141ad
Binary files /dev/null and b/common/target/classes/com/bwie/common/result/PageResult.class differ
diff --git a/common/target/classes/com/bwie/common/result/Result.class b/common/target/classes/com/bwie/common/result/Result.class
new file mode 100644
index 0000000..920f38b
Binary files /dev/null and b/common/target/classes/com/bwie/common/result/Result.class differ
diff --git a/common/target/classes/com/bwie/common/utils/FastUtil.class b/common/target/classes/com/bwie/common/utils/FastUtil.class
new file mode 100644
index 0000000..3e6e463
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/FastUtil.class differ
diff --git a/common/target/classes/com/bwie/common/utils/HttpUtils$1.class b/common/target/classes/com/bwie/common/utils/HttpUtils$1.class
new file mode 100644
index 0000000..252829d
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/HttpUtils$1.class differ
diff --git a/common/target/classes/com/bwie/common/utils/HttpUtils.class b/common/target/classes/com/bwie/common/utils/HttpUtils.class
new file mode 100644
index 0000000..d9cb2c1
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/HttpUtils.class differ
diff --git a/common/target/classes/com/bwie/common/utils/JwtUtils.class b/common/target/classes/com/bwie/common/utils/JwtUtils.class
new file mode 100644
index 0000000..694e65b
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/JwtUtils.class differ
diff --git a/common/target/classes/com/bwie/common/utils/MsgUtil.class b/common/target/classes/com/bwie/common/utils/MsgUtil.class
new file mode 100644
index 0000000..89d39c4
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/MsgUtil.class differ
diff --git a/common/target/classes/com/bwie/common/utils/StringUtils.class b/common/target/classes/com/bwie/common/utils/StringUtils.class
new file mode 100644
index 0000000..80b387c
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/StringUtils.class differ
diff --git a/common/target/classes/com/bwie/common/utils/TelSmsUtils.class b/common/target/classes/com/bwie/common/utils/TelSmsUtils.class
new file mode 100644
index 0000000..38661c5
Binary files /dev/null and b/common/target/classes/com/bwie/common/utils/TelSmsUtils.class differ
diff --git a/common/target/common-1.0-SNAPSHOT.jar b/common/target/common-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..ddbd65d
Binary files /dev/null and b/common/target/common-1.0-SNAPSHOT.jar differ
diff --git a/common/target/maven-archiver/pom.properties b/common/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..a3e56a7
--- /dev/null
+++ b/common/target/maven-archiver/pom.properties
@@ -0,0 +1,3 @@
+artifactId=common
+groupId=com.wzx
+version=1.0-SNAPSHOT
diff --git a/common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..5e4795e
--- /dev/null
+++ b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,23 @@
+com\bwie\common\result\PageResult.class
+com\bwie\common\domain\Menu.class
+com\bwie\common\utils\MsgUtil.class
+com\bwie\common\domain\User.class
+com\bwie\common\utils\TelSmsUtils.class
+com\bwie\common\utils\HttpUtils.class
+com\bwie\common\utils\JwtUtils.class
+com\bwie\common\domain\response\ResponseHotel.class
+com\bwie\common\utils\StringUtils.class
+com\bwie\common\constants\JwtConstants.class
+com\bwie\common\utils\HttpUtils$1.class
+com\bwie\common\constants\Constants.class
+com\bwie\common\domain\request\QueryHotel.class
+com\bwie\common\constants\RabbitMQConstants.class
+com\bwie\common\constants\TokenConstants.class
+com\bwie\common\result\Result.class
+com\bwie\common\domain\request\RequestUser.class
+com\bwie\common\domain\Order.class
+com\bwie\common\domain\Hotel.class
+com\bwie\common\domain\Stay.class
+com\bwie\common\utils\FastUtil.class
+com\bwie\common\domain\MyMenu.class
+com\bwie\common\domain\response\ResponseUser.class
diff --git a/common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..d04b956
--- /dev/null
+++ b/common/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,22 @@
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\response\ResponseHotel.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\constants\TokenConstants.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\utils\TelSmsUtils.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\Hotel.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\User.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\Order.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\result\Result.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\request\QueryHotel.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\utils\MsgUtil.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\constants\RabbitMQConstants.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\MyMenu.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\result\PageResult.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\response\ResponseUser.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\Menu.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\request\RequestUser.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\utils\FastUtil.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\utils\StringUtils.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\utils\HttpUtils.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\utils\JwtUtils.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\constants\Constants.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\constants\JwtConstants.java
+D:\Project\Finish\common\src\main\java\com\bwie\common\domain\Stay.java
diff --git a/common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/common/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/gateway/pom.xml b/gateway/pom.xml
new file mode 100644
index 0000000..cccf1d1
--- /dev/null
+++ b/gateway/pom.xml
@@ -0,0 +1,38 @@
+
+
+
+ Finish
+ com.wzx
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ gateway
+
+
+
+ com.wzx
+ common
+ 1.0-SNAPSHOT
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-gateway
+
+
+
+ com.alibaba.cloud
+ spring-cloud-alibaba-sentinel-gateway
+
+
+
+ com.alibaba.csp
+ sentinel-spring-cloud-gateway-adapter
+
+
+
+
diff --git a/gateway/src/main/java/com/bwie/gateway/GatewayApp.java b/gateway/src/main/java/com/bwie/gateway/GatewayApp.java
new file mode 100644
index 0000000..962bc29
--- /dev/null
+++ b/gateway/src/main/java/com/bwie/gateway/GatewayApp.java
@@ -0,0 +1,11 @@
+package com.bwie.gateway;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class GatewayApp {
+ public static void main(String[] args) {
+ SpringApplication.run(GatewayApp.class);
+ }
+}
diff --git a/gateway/src/main/java/com/bwie/gateway/config/IgnoreWhiteConfig.java b/gateway/src/main/java/com/bwie/gateway/config/IgnoreWhiteConfig.java
new file mode 100644
index 0000000..5705d6f
--- /dev/null
+++ b/gateway/src/main/java/com/bwie/gateway/config/IgnoreWhiteConfig.java
@@ -0,0 +1,32 @@
+package com.bwie.gateway.config;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.Data;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @description: 放行白名单配置
+ * @author DongZl
+ */
+@Configuration
+@RefreshScope
+@ConfigurationProperties(prefix = "ignore")
+@Data
+@Log4j2
+public class IgnoreWhiteConfig {
+ /**
+ * 放行白名单配置,网关不校验此处的白名单
+ */
+ private List whites = new ArrayList<>();
+
+ public void setWhites(List whites) {
+ log.info("加载网关路径白名单:{}", JSONObject.toJSONString(whites));
+ this.whites = whites;
+ }
+}
diff --git a/gateway/src/main/java/com/bwie/gateway/filters/AuthFilters.java b/gateway/src/main/java/com/bwie/gateway/filters/AuthFilters.java
new file mode 100644
index 0000000..6cb73be
--- /dev/null
+++ b/gateway/src/main/java/com/bwie/gateway/filters/AuthFilters.java
@@ -0,0 +1,64 @@
+package com.bwie.gateway.filters;
+
+import cn.hutool.jwt.JWT;
+import com.bwie.common.constants.TokenConstants;
+import com.bwie.common.utils.JwtUtils;
+import com.bwie.common.utils.StringUtils;
+import com.bwie.gateway.config.IgnoreWhiteConfig;
+import com.bwie.gateway.utils.GatewayUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cloud.gateway.filter.GatewayFilterChain;
+import org.springframework.cloud.gateway.filter.GlobalFilter;
+import org.springframework.core.Ordered;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.stereotype.Component;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+import java.util.List;
+
+@Component
+public class AuthFilters implements GlobalFilter, Ordered {
+
+ @Autowired
+ private IgnoreWhiteConfig ignoreWhiteConfig;
+ @Autowired
+ private RedisTemplate redisTemplate;
+
+ @Override
+ public Mono filter(ServerWebExchange exchange, GatewayFilterChain chain) {
+ //拿出白名单路径
+ List whites = ignoreWhiteConfig.getWhites();
+ //取出当前路径
+ ServerHttpRequest request = exchange.getRequest();
+ String path = request.getURI().getPath();
+ //判断当前路径是否与白名单路径一致
+ if (StringUtils.matches(path,whites)){
+ //一致
+ //放行
+ return chain.filter(exchange);
+ }
+ //判断token是否为空
+ String token = request.getHeaders().getFirst(TokenConstants.TOKEN);
+ if (StringUtils.isEmpty(token)){
+ //判断
+ return GatewayUtils.errorResponse(exchange,"token不能为空", HttpStatus.UNAUTHORIZED);
+ }
+ //判断token是否过期
+ String userKey = JwtUtils.getUserKey(token);
+ Boolean aBoolean = redisTemplate.hasKey(TokenConstants.LOGIN_TOKEN_KEY + userKey);
+ if (null==aBoolean && !aBoolean){
+ return GatewayUtils.errorResponse(exchange,"token已经过期");
+ }
+
+ //全部放行
+ return chain.filter(exchange);
+ }
+
+ @Override
+ public int getOrder() {
+ return 0;
+ }
+}
diff --git a/gateway/src/main/java/com/bwie/gateway/utils/GatewayUtils.java b/gateway/src/main/java/com/bwie/gateway/utils/GatewayUtils.java
new file mode 100644
index 0000000..7b789e5
--- /dev/null
+++ b/gateway/src/main/java/com/bwie/gateway/utils/GatewayUtils.java
@@ -0,0 +1,98 @@
+package com.bwie.gateway.utils;
+
+import com.alibaba.fastjson.JSONObject;
+import com.bwie.common.result.Result;
+import com.bwie.common.utils.StringUtils;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.core.io.buffer.DataBuffer;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.server.reactive.ServerHttpRequest;
+import org.springframework.http.server.reactive.ServerHttpResponse;
+import org.springframework.web.server.ServerWebExchange;
+import reactor.core.publisher.Mono;
+
+/**
+ * @author DongZl
+ * @description: 网关处理工具类
+ */
+@Log4j2
+public class GatewayUtils {
+ /**
+ * 添加请求头参数
+ * @param mutate 修改对象
+ * @param key 键
+ * @param value 值
+ */
+ public static void addHeader(ServerHttpRequest.Builder mutate, String key, Object value) {
+ if (StringUtils.isEmpty(key)){
+ log.warn("添加请求头参数键不可以为空");
+ return;
+ }
+ if (value == null) {
+ log.warn("添加请求头参数:[{}]值为空",key);
+ return;
+ }
+ String valueStr = value.toString();
+ mutate.header(key, valueStr);
+ log.info("添加请求头参数成功 - 键:[{}] , 值:[{}]", key , value);
+ }
+
+ /**
+ * 删除请求头参数
+ * @param mutate 修改对象
+ * @param key 键
+ */
+ public static void removeHeader(ServerHttpRequest.Builder mutate, String key) {
+ if (StringUtils.isEmpty(key)){
+ log.warn("删除请求头参数键不可以为空");
+ return;
+ }
+ mutate.headers(httpHeaders -> httpHeaders.remove(key)).build();
+ log.info("删除请求头参数 - 键:[{}]",key);
+ }
+
+ /**
+ * 错误结果响应
+ * @param exchange 响应上下文
+ * @param msg 响应消息
+ * @return
+ */
+ public static Mono errorResponse(ServerWebExchange exchange, String msg, HttpStatus httpStatus) {
+ ServerHttpResponse response = exchange.getResponse();
+ //设置HTTP响应头状态
+ response.setStatusCode(httpStatus);
+ //设置HTTP响应头文本格式
+ response.getHeaders().add(HttpHeaders.CONTENT_TYPE, "application/json");
+ //定义响应内容
+ Result> result = Result.error(msg);
+ String resultJson = JSONObject.toJSONString(result);
+ log.error("[鉴权异常处理]请求路径:[{}],异常信息:[{}],响应结果:[{}]", exchange.getRequest().getPath(), msg, resultJson);
+ DataBuffer dataBuffer = response.bufferFactory().wrap(resultJson.getBytes());
+ //进行响应
+ return response.writeWith(Mono.just(dataBuffer));
+ }
+
+ /**
+ * 错误结果响应
+ * @param exchange 响应上下文
+ * @param msg 响应消息
+ * @return
+ */
+ public static Mono errorResponse(ServerWebExchange exchange, String msg) {
+ ServerHttpResponse response = exchange.getResponse();
+ //设置HTTP响应头状态
+ response.setStatusCode(HttpStatus.OK);
+ //设置HTTP响应头文本格式
+ response.getHeaders().add(HttpHeaders.CONTENT_TYPE, "application/json");
+ //定义响应内容
+ Result> result = Result.error(msg);
+ String resultJson = JSONObject.toJSONString(result);
+ log.error("[鉴权异常处理]请求路径:[{}],异常信息:[{}],响应结果:[{}]", exchange.getRequest().getPath(), msg, resultJson);
+ DataBuffer dataBuffer = response.bufferFactory().wrap(resultJson.getBytes());
+ //进行响应
+ return response.writeWith(Mono.just(dataBuffer));
+ }
+
+
+}
diff --git a/gateway/src/main/resources/bootstrap.yml b/gateway/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..e85d644
--- /dev/null
+++ b/gateway/src/main/resources/bootstrap.yml
@@ -0,0 +1,31 @@
+# Tomcat
+server:
+ port: 18080
+# Spring
+spring:
+ application:
+ # 应用名称
+ name: gateway
+ profiles:
+ # 环境配置
+ active: dev
+ main:
+ # 允许使用循环引用
+ allow-circular-references: true
+ # 允许定义相同的bean对象 去覆盖原有的
+ allow-bean-definition-overriding: true
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: 124.221.214.183:8848
+ namespace: lc
+ config:
+ # 配置中心地址
+ server-addr: 124.221.214.183:8848
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
+ namespace: lc
diff --git a/gateway/target/classes/bootstrap.yml b/gateway/target/classes/bootstrap.yml
new file mode 100644
index 0000000..e85d644
--- /dev/null
+++ b/gateway/target/classes/bootstrap.yml
@@ -0,0 +1,31 @@
+# Tomcat
+server:
+ port: 18080
+# Spring
+spring:
+ application:
+ # 应用名称
+ name: gateway
+ profiles:
+ # 环境配置
+ active: dev
+ main:
+ # 允许使用循环引用
+ allow-circular-references: true
+ # 允许定义相同的bean对象 去覆盖原有的
+ allow-bean-definition-overriding: true
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: 124.221.214.183:8848
+ namespace: lc
+ config:
+ # 配置中心地址
+ server-addr: 124.221.214.183:8848
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
+ namespace: lc
diff --git a/gateway/target/classes/com/bwie/gateway/GatewayApp.class b/gateway/target/classes/com/bwie/gateway/GatewayApp.class
new file mode 100644
index 0000000..e14652d
Binary files /dev/null and b/gateway/target/classes/com/bwie/gateway/GatewayApp.class differ
diff --git a/gateway/target/classes/com/bwie/gateway/config/IgnoreWhiteConfig.class b/gateway/target/classes/com/bwie/gateway/config/IgnoreWhiteConfig.class
new file mode 100644
index 0000000..104e718
Binary files /dev/null and b/gateway/target/classes/com/bwie/gateway/config/IgnoreWhiteConfig.class differ
diff --git a/gateway/target/classes/com/bwie/gateway/filters/AuthFilters.class b/gateway/target/classes/com/bwie/gateway/filters/AuthFilters.class
new file mode 100644
index 0000000..a1d5ad7
Binary files /dev/null and b/gateway/target/classes/com/bwie/gateway/filters/AuthFilters.class differ
diff --git a/gateway/target/classes/com/bwie/gateway/utils/GatewayUtils.class b/gateway/target/classes/com/bwie/gateway/utils/GatewayUtils.class
new file mode 100644
index 0000000..2da8843
Binary files /dev/null and b/gateway/target/classes/com/bwie/gateway/utils/GatewayUtils.class differ
diff --git a/gateway/target/gateway-1.0-SNAPSHOT.jar b/gateway/target/gateway-1.0-SNAPSHOT.jar
new file mode 100644
index 0000000..f153f92
Binary files /dev/null and b/gateway/target/gateway-1.0-SNAPSHOT.jar differ
diff --git a/gateway/target/maven-archiver/pom.properties b/gateway/target/maven-archiver/pom.properties
new file mode 100644
index 0000000..f5a8d96
--- /dev/null
+++ b/gateway/target/maven-archiver/pom.properties
@@ -0,0 +1,3 @@
+artifactId=gateway
+groupId=com.wzx
+version=1.0-SNAPSHOT
diff --git a/gateway/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/gateway/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
new file mode 100644
index 0000000..6367346
--- /dev/null
+++ b/gateway/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
@@ -0,0 +1,4 @@
+com\bwie\gateway\filters\AuthFilters.class
+com\bwie\gateway\config\IgnoreWhiteConfig.class
+com\bwie\gateway\GatewayApp.class
+com\bwie\gateway\utils\GatewayUtils.class
diff --git a/gateway/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/gateway/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
new file mode 100644
index 0000000..04a4fcd
--- /dev/null
+++ b/gateway/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
@@ -0,0 +1,4 @@
+D:\Project\Finish\gateway\src\main\java\com\bwie\gateway\filters\AuthFilters.java
+D:\Project\Finish\gateway\src\main\java\com\bwie\gateway\utils\GatewayUtils.java
+D:\Project\Finish\gateway\src\main\java\com\bwie\gateway\config\IgnoreWhiteConfig.java
+D:\Project\Finish\gateway\src\main\java\com\bwie\gateway\GatewayApp.java
diff --git a/gateway/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst b/gateway/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/gateway/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/gateway/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst
new file mode 100644
index 0000000..e69de29
diff --git a/models/pom.xml b/models/pom.xml
new file mode 100644
index 0000000..9bca3ac
--- /dev/null
+++ b/models/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ Finish
+ com.wzx
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ models
+ pom
+
+ system
+
+
+
+
diff --git a/models/system/pom.xml b/models/system/pom.xml
new file mode 100644
index 0000000..94fe829
--- /dev/null
+++ b/models/system/pom.xml
@@ -0,0 +1,85 @@
+
+
+
+ models
+ com.wzx
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ system
+
+
+
+
+ com.wzx
+ common
+ 1.0-SNAPSHOT
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ 1.2.8
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.2.2
+
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+ 1.4.1
+
+
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ com.qiniu
+ qiniu-java-sdk
+ 7.2.0
+
+
+
+ com.easemob.im
+ im-sdk-core
+ 0.6.0
+
+
+ com.wzx
+ common
+ 1.0-SNAPSHOT
+ compile
+
+
+ com.easemob.im
+ im-sdk-core
+ 0.6.0
+
+
+
+
diff --git a/models/system/src/main/java/com/bwie/system/SystemApp.java b/models/system/src/main/java/com/bwie/system/SystemApp.java
new file mode 100644
index 0000000..9fd6134
--- /dev/null
+++ b/models/system/src/main/java/com/bwie/system/SystemApp.java
@@ -0,0 +1,11 @@
+package com.bwie.system;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class SystemApp {
+ public static void main(String[] args) {
+ SpringApplication.run(SystemApp.class);
+ }
+}
diff --git a/models/system/src/main/java/com/bwie/system/controller/HotelController.java b/models/system/src/main/java/com/bwie/system/controller/HotelController.java
new file mode 100644
index 0000000..98172cd
--- /dev/null
+++ b/models/system/src/main/java/com/bwie/system/controller/HotelController.java
@@ -0,0 +1,90 @@
+package com.bwie.system.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.bwie.common.domain.Order;
+import com.bwie.common.domain.Stay;
+import com.bwie.common.domain.request.QueryHotel;
+import com.bwie.common.domain.response.ResponseHotel;
+import com.bwie.common.result.Result;
+import com.bwie.system.service.HotelService;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@RestController
+@RequestMapping("/hotel")
+@Log4j2
+public class HotelController {
+
+ @Autowired
+ private HotelService hotelService;
+ @Autowired
+ private HttpServletRequest request;
+
+ /**
+ * 酒店列表
+ * @param queryHotel
+ * @return
+ */
+ @PostMapping("/ShowHotelAll")
+ public Result> ShowHotelAll(@RequestBody QueryHotel queryHotel){
+ log.info("功能名称:查询酒店列表,请求URI:{},请求方法:{}",request.getRequestURI(),
+ request.getMethod());
+ Result> result=hotelService.ShowHotelAll(queryHotel);
+ log.info("功能名称:查询酒店列表,请求URI:{},请求方法:{},返回结果:{}",request.getRequestURI(),
+ request.getMethod(),JSONObject.toJSONString(result));
+ return result;
+ }
+
+ /**
+ * 添加订单
+ * @param order
+ * @return
+ */
+ @PostMapping("/insertOrder")
+ public Result insertOrder(Order order){
+ log.info("功能名称:添加订单,请求URI:{},请求方法:{},请求参数:{}",request.getRequestURI(),
+ request.getMethod(),JSONObject.toJSONString(order));
+ Result result=hotelService.insertOrder(order);
+ log.info("功能名称:添加订单,请求URI:{},请求方法:{},返回结果:{}",request.getRequestURI(),
+ request.getMethod(),JSONObject.toJSONString(result));
+ return result;
+ }
+
+ /**
+ * 添加入住登记信息
+ * @param stay
+ * @return
+ */
+ @PostMapping("/insertStay")
+ public Result insertStay(Stay stay){
+ log.info("功能名称:新增入住登记信息,请求URI:{},请求方法:{},请求参数:{}",request.getRequestURI(),
+ request.getMethod(),JSONObject.toJSONString(stay));
+ Result result=hotelService.insertStay(stay);
+ log.info("功能名称:新增入住登记信息,请求URI:{},请求方法:{},请求参数:{}",request.getRequestURI(),
+ request.getMethod(),JSONObject.toJSONString(result));
+ return result;
+ }
+
+ /**
+ * 上传七牛云
+ * @return
+ */
+ @PostMapping("/QiNiuUpload")
+ public Result QiNiuUpload(){
+ return hotelService.QiNiuUpload();
+ }
+
+ /**
+ * 查看七牛云存储文件
+ * @return
+ */
+ @GetMapping("/SeeQiNiu")
+ public Result SeeQiNiu(){
+ return hotelService.SeeQiNiu();
+ }
+
+}
diff --git a/models/system/src/main/java/com/bwie/system/controller/MenuController.java b/models/system/src/main/java/com/bwie/system/controller/MenuController.java
new file mode 100644
index 0000000..88be462
--- /dev/null
+++ b/models/system/src/main/java/com/bwie/system/controller/MenuController.java
@@ -0,0 +1,50 @@
+package com.bwie.system.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.bwie.common.domain.Menu;
+import com.bwie.common.domain.MyMenu;
+import com.bwie.common.result.Result;
+import com.bwie.system.service.MenuService;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@RestController
+@RequestMapping("/menu")
+@Log4j2
+public class MenuController {
+
+ @Autowired
+ private MenuService menuService;
+
+ @Autowired
+ private HttpServletRequest request;
+
+ /**
+ * 查询菜单
+ * @return
+ */
+ @GetMapping("/ShowMenuAll")
+ public Result> ShowMenuAll(){
+ log.info("功能名称:查询菜单列表,请求URI:{},请求方法:{}",request.getRequestURI(),
+ request.getMethod());
+ List