commit
01e2fd5808
@ -0,0 +1,35 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
@ -0,0 +1,45 @@
|
||||
<?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>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<artifactId>api-passenger</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- Spring Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- util 工具模块 -->
|
||||
<dependency>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common-entity</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
package com.greateme.passenger;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 乘客微服务的启动类
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 18:17:31
|
||||
* @file ApiPassengerApplication.java
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class ApiPassengerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiPassengerApplication.class, args);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.greateme.passenger.controller;
|
||||
|
||||
import com.greateme.entity.respose.ResponseEntity;
|
||||
import com.greateme.passenger.entity.dto.PassengerVerificationCodeDTO;
|
||||
import com.greateme.passenger.service.PassengerVerificationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 乘客验证码的前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 18:42:34
|
||||
* @file PassengerVerificationController.java
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/verification")
|
||||
public class PassengerVerificationController {
|
||||
|
||||
@Autowired
|
||||
private PassengerVerificationService verificationService;
|
||||
|
||||
@PostMapping("/code")
|
||||
public ResponseEntity<String> verificationCode(@RequestBody PassengerVerificationCodeDTO verificationCode) {
|
||||
return ResponseEntity.success(this.verificationService.generationPhoneVerificationCode(verificationCode));
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.greateme.passenger.entity.dto;
|
||||
|
||||
import com.greateme.util.JsonUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 乘客手机验证码的DTO
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 18:41:03
|
||||
* @file PassengerVerificationCodeDTO.java
|
||||
*/
|
||||
public class PassengerVerificationCodeDTO implements Serializable {
|
||||
/**
|
||||
* 乘客的手机号码
|
||||
*/
|
||||
private String passengerPhone;
|
||||
|
||||
public String getPassengerPhone() {
|
||||
return passengerPhone;
|
||||
}
|
||||
|
||||
public void setPassengerPhone(String passengerPhone) {
|
||||
this.passengerPhone = passengerPhone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonUtil.toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.greateme.passenger.entity.dto;
|
||||
|
||||
import com.greateme.util.JsonUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 验证码存入redis的实体类
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 20:30:05
|
||||
* @file PassengerVerificationCodeRedisDTO.java
|
||||
*/
|
||||
public class PassengerVerificationCodeRedisDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 验证码答案
|
||||
*/
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
* 验证码的token
|
||||
*/
|
||||
private String token;
|
||||
|
||||
/**
|
||||
* 客户的手机号码
|
||||
*/
|
||||
private String passengerPhone;
|
||||
|
||||
public String getVerificationCode() {
|
||||
return verificationCode;
|
||||
}
|
||||
|
||||
public void setVerificationCode(String verificationCode) {
|
||||
this.verificationCode = verificationCode;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public String getPassengerPhone() {
|
||||
return passengerPhone;
|
||||
}
|
||||
|
||||
public void setPassengerPhone(String passengerPhone) {
|
||||
this.passengerPhone = passengerPhone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonUtil.toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.greateme.passenger.entity.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 乘客验证码的视图对象
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 19:40:35
|
||||
* @file PassengerVerificationCodeVO.java
|
||||
*/
|
||||
public class PassengerVerificationCodeVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 手机验证码
|
||||
*/
|
||||
private String verificationCode;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String verificationToken;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.greateme.passenger.service;
|
||||
|
||||
import com.greateme.passenger.entity.dto.PassengerVerificationCodeDTO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 乘客验证码的服务层接口
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 19:39:43
|
||||
* @file PassengerVerificationService.java
|
||||
*/
|
||||
public interface PassengerVerificationService {
|
||||
|
||||
/**
|
||||
* 生成手机验证码
|
||||
*
|
||||
* @param verificationCode 手机验证码内容
|
||||
* @return 手机验证码后续的验证token
|
||||
*/
|
||||
String generationPhoneVerificationCode(PassengerVerificationCodeDTO verificationCode);
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
server:
|
||||
port: 8080
|
@ -0,0 +1,18 @@
|
||||
<?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>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>online-taxi-public</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>api-passenger</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>api</artifactId>
|
||||
|
||||
</project>
|
@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
@ -0,0 +1,15 @@
|
||||
<?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>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<description>公共常量类模块</description>
|
||||
|
||||
<artifactId>common-contant</artifactId>
|
||||
|
||||
</project>
|
@ -0,0 +1,30 @@
|
||||
package com.greateme.contant.http;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* http状态的常量类
|
||||
* </p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 20:19:15
|
||||
* @file HttpStatus.java
|
||||
*/
|
||||
public class HttpStatus {
|
||||
|
||||
/**
|
||||
* 此实例不允许被实例化
|
||||
*/
|
||||
private HttpStatus() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 成功的常量状态码
|
||||
*/
|
||||
public static final int SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 成功的常量状态信息
|
||||
*/
|
||||
public static final String SUCCESS_MESSAGE = "Success";
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
@ -0,0 +1,28 @@
|
||||
<?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>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<description>公共实体类模块</description>
|
||||
|
||||
<artifactId>common-entity</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- 公共常量类模块 -->
|
||||
<dependency>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common-contant</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- util 工具模块 -->
|
||||
<dependency>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common-util</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,92 @@
|
||||
package com.greateme.entity.respose;
|
||||
|
||||
import com.greateme.contant.http.HttpStatus;
|
||||
import com.greateme.util.JsonUtil;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p></p>
|
||||
*
|
||||
* @author XiaoHH
|
||||
* @version 1.0.0
|
||||
* @date 2023-05-30 星期二 20:00:00
|
||||
* @file ResponseEntity.java
|
||||
*/
|
||||
public class ResponseEntity<T> implements Serializable {
|
||||
/**
|
||||
* 无参构造
|
||||
*/
|
||||
public ResponseEntity() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 全参构造函数
|
||||
*
|
||||
* @param code 状态码
|
||||
* @param date 数据内容
|
||||
* @param message 处理的消息信息
|
||||
*/
|
||||
public ResponseEntity(int code, T date, String message) {
|
||||
this.code = code;
|
||||
this.date = date;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回的状态码
|
||||
* 200 => 成功
|
||||
* 500 => 处理报错
|
||||
*/
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 返回的数据内容
|
||||
*/
|
||||
private T date;
|
||||
|
||||
/**
|
||||
* 返回的处理的消息信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 处理成功的返回方法
|
||||
*
|
||||
* @param data 数据内容
|
||||
* @param <T> 数据内容的类型
|
||||
* @return 返回的实体
|
||||
*/
|
||||
public static <T> ResponseEntity<T> success(T data) {
|
||||
return new ResponseEntity<>(HttpStatus.SUCCESS, data, HttpStatus.SUCCESS_MESSAGE);
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public T getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public void setDate(T date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return JsonUtil.toJson(this);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?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>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>common-util</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Gson的json工具 -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
<?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>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>online-taxi-public</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<description>公共模块</description>
|
||||
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>common-entity</module>
|
||||
<module>common-util</module>
|
||||
<module>common-contant</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>common</artifactId>
|
||||
|
||||
</project>
|
@ -0,0 +1,68 @@
|
||||
<?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>
|
||||
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>online-taxi-public</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>api</module>
|
||||
<module>common</module>
|
||||
</modules>
|
||||
<description>马士兵的滴约打车项目</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- 软件版本号 -->
|
||||
<online-taxi-public.version>1.0-SNAPSHOT</online-taxi-public.version>
|
||||
<spring-boot.version>2.6.14</spring-boot.version>
|
||||
<spring-cloud.version>2021.0.7</spring-cloud.version>
|
||||
<gson.version>2.10.1</gson.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- SpringBoot 相关依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Gson 的 json 处理 -->
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 公共常量类模块 -->
|
||||
<dependency>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common-contant</artifactId>
|
||||
<version>${online-taxi-public.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 公共实体类模块 -->
|
||||
<dependency>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common-entity</artifactId>
|
||||
<version>${online-taxi-public.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- util 工具模块 -->
|
||||
<dependency>
|
||||
<groupId>com.greateme</groupId>
|
||||
<artifactId>common-util</artifactId>
|
||||
<version>${online-taxi-public.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
Loading…
Reference in new issue