diff --git a/api-boss/pom.xml b/api-boss/pom.xml
new file mode 100644
index 0000000..acb5592
--- /dev/null
+++ b/api-boss/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ api-boss
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/api-driver/pom.xml b/api-driver/pom.xml
new file mode 100644
index 0000000..fed50e2
--- /dev/null
+++ b/api-driver/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ api-driver
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/api-passenger/pom.xml b/api-passenger/pom.xml
index 6223e55..575f4f4 100644
--- a/api-passenger/pom.xml
+++ b/api-passenger/pom.xml
@@ -14,6 +14,7 @@
8
8
+ 2021.1
@@ -21,5 +22,20 @@
org.springframework.boot
spring-boot-starter-web
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+ org.springframework.cloud
+ spring-cloud-starter-loadbalancer
+
\ No newline at end of file
diff --git a/api-passenger/src/main/java/com/mashibing/passenger/ApiPassengerApplication.java b/api-passenger/src/main/java/com/mashibing/passenger/ApiPassengerApplication.java
index 5dc874d..58b752f 100644
--- a/api-passenger/src/main/java/com/mashibing/passenger/ApiPassengerApplication.java
+++ b/api-passenger/src/main/java/com/mashibing/passenger/ApiPassengerApplication.java
@@ -2,12 +2,16 @@ package com.mashibing.passenger;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
/**
* @author fangyu
* @version v1.0.0
* @date 2022/7/24 01:07
*/
+@EnableFeignClients
+@EnableDiscoveryClient
@SpringBootApplication
public class ApiPassengerApplication {
diff --git a/api-passenger/src/main/java/com/mashibing/passenger/remote/ServiceVerificationCodeClient.java b/api-passenger/src/main/java/com/mashibing/passenger/remote/ServiceVerificationCodeClient.java
new file mode 100644
index 0000000..9b7bff1
--- /dev/null
+++ b/api-passenger/src/main/java/com/mashibing/passenger/remote/ServiceVerificationCodeClient.java
@@ -0,0 +1,26 @@
+package com.mashibing.passenger.remote;
+
+import com.mashibing.common.dto.ResponseResult;
+import com.mashibing.common.response.NumberCodeResponse;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 22:48
+ */
+@FeignClient("service-verificationcode")
+public interface ServiceVerificationCodeClient {
+
+ /**
+ * 获取验证码(远程调用)
+ *
+ * @param size
+ * @return ResponseResult
+ */
+ @RequestMapping(method = RequestMethod.GET, value = "/numberCode/${size}")
+ ResponseResult getNumberCode(@PathVariable("size") int size);
+}
diff --git a/api-passenger/src/main/java/com/mashibing/passenger/request/VerificationCodeDTO.java b/api-passenger/src/main/java/com/mashibing/passenger/request/VerificationCodeDTO.java
index 8f61dd3..af94ff3 100644
--- a/api-passenger/src/main/java/com/mashibing/passenger/request/VerificationCodeDTO.java
+++ b/api-passenger/src/main/java/com/mashibing/passenger/request/VerificationCodeDTO.java
@@ -1,26 +1,13 @@
package com.mashibing.passenger.request;
+import lombok.Data;
+
/**
* @author fangyu
* @version v1.0.0
* @date 2022/7/24 01:21
*/
+@Data
public class VerificationCodeDTO {
-
private String passengerPhone;
-
- public String getPassengerPhone() {
- return passengerPhone;
- }
-
- public void setPassengerPhone(String passengerPhone) {
- this.passengerPhone = passengerPhone;
- }
-
- @Override
- public String toString() {
- return "{\"VerificationCodeDTO\":{"
- + " \"passengerPhone\":\"" + passengerPhone + "\""
- + "}}";
- }
}
diff --git a/api-passenger/src/main/java/com/mashibing/passenger/service/VerificationCodeService.java b/api-passenger/src/main/java/com/mashibing/passenger/service/VerificationCodeService.java
index bd5f0f1..28af3e2 100644
--- a/api-passenger/src/main/java/com/mashibing/passenger/service/VerificationCodeService.java
+++ b/api-passenger/src/main/java/com/mashibing/passenger/service/VerificationCodeService.java
@@ -1,6 +1,10 @@
package com.mashibing.passenger.service;
+import com.mashibing.common.dto.ResponseResult;
+import com.mashibing.common.response.NumberCodeResponse;
+import com.mashibing.passenger.remote.ServiceVerificationCodeClient;
import net.sf.json.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
@@ -11,10 +15,18 @@ import org.springframework.stereotype.Service;
@Service
public class VerificationCodeService {
+ @Autowired
+ private ServiceVerificationCodeClient verificationCodeServiceClient;
+
public String generateCode(String passengerPhone) {
// 调用验证码服务,获取验证码
System.out.println("调用验证码服务,获取验证码");
+ ResponseResult numberCodeResponse = verificationCodeServiceClient.getNumberCode(6);
+ int numberCode = numberCodeResponse.getData().getNumberCode();
+
+ System.out.println("remote number code:" + numberCode);
+
// 存入redis
System.out.println("存入redis");
diff --git a/api-passenger/src/main/resources/application.yml b/api-passenger/src/main/resources/application.yml
index 54b155f..e90ecf4 100644
--- a/api-passenger/src/main/resources/application.yml
+++ b/api-passenger/src/main/resources/application.yml
@@ -1,2 +1,9 @@
server:
- port: 8081
\ No newline at end of file
+ port: 8081
+spring:
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848
+ application:
+ name: api-passenger
\ No newline at end of file
diff --git a/internal-common/pom.xml b/internal-common/pom.xml
new file mode 100644
index 0000000..a0afd4f
--- /dev/null
+++ b/internal-common/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ internal-common
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/internal-common/src/main/java/com/mashibing/common/constant/AmapConfigConstants.java b/internal-common/src/main/java/com/mashibing/common/constant/AmapConfigConstants.java
new file mode 100644
index 0000000..9168ee1
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/constant/AmapConfigConstants.java
@@ -0,0 +1,41 @@
+package com.mashibing.common.constant;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:10
+ */
+public class AmapConfigConstants {
+ /**
+ * 路径规划地址
+ */
+ public static final String DIRECTION_URL = "https://restapi.amap.com/v3/direction/driving";
+
+ /**
+ * 行政区域查询
+ */
+ public static final String DISTRICT_URL = "https://restapi.amap.com/v3/config/district";
+
+ /**
+ * 路径规划 json key值
+ */
+ public static final String STATUS = "status";
+
+ public static final String ROUTE = "route";
+
+ public static final String PATHS = "paths";
+
+ public static final String DISTANCE = "distance";
+
+ public static final String DURATION = "duration";
+
+ public static final String DISTRICTS = "districts";
+
+ public static final String ADCODE = "adcode";
+
+ public static final String NAME = "name";
+
+ public static final String LEVEL = "level";
+
+ public static final String STREET = "street";
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java b/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java
new file mode 100644
index 0000000..29be01c
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java
@@ -0,0 +1,56 @@
+package com.mashibing.common.constant;
+
+import lombok.Getter;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 22:16
+ */
+public enum CommonStatusEnum {
+
+ /**
+ * 验证码错误提示:1000-1099
+ */
+ VERIFICATION_CODE_ERROR(1099, "验证码不正确"),
+
+ /**
+ * Token类提示:1100-1199
+ */
+ TOKEN_ERROR(1199, "token错误"),
+
+ /**
+ * 用户提示:1200-1299
+ */
+ USER_NOT_EXISTS(1200, "当前用户不存在"),
+
+ /**
+ * 计价规则:1300-1399
+ */
+ PRICE_RULE_EMPTY(1300, "计价规则不存在"),
+
+ /**
+ * 地图信息:1400-1499
+ */
+ MAP_DISTRICT_ERROR(1400, "请求地图错误"),
+
+ /**
+ * 成功
+ */
+ SUCCESS(1, "success"),
+
+ /**
+ * 失败
+ */
+ FAIL(0, "fail");
+
+ @Getter
+ private int code;
+ @Getter
+ private String value;
+
+ CommonStatusEnum(int code, String value) {
+ this.code = code;
+ this.value = value;
+ }
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/constant/IdentityConstants.java b/internal-common/src/main/java/com/mashibing/common/constant/IdentityConstants.java
new file mode 100644
index 0000000..5c40de5
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/constant/IdentityConstants.java
@@ -0,0 +1,18 @@
+package com.mashibing.common.constant;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:11
+ */
+public class IdentityConstants {
+ /**
+ * 乘客身份
+ */
+ public static final String PASSENGER_IDENTITY = "1";
+
+ /**
+ * 司机身份
+ */
+ public static final String DRIVER_IDENTITY = "2";
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/constant/TokenConstants.java b/internal-common/src/main/java/com/mashibing/common/constant/TokenConstants.java
new file mode 100644
index 0000000..a2154ec
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/constant/TokenConstants.java
@@ -0,0 +1,15 @@
+package com.mashibing.common.constant;
+
+/**
+ * token常量类
+ *
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:12
+ */
+public class TokenConstants {
+
+ public static final String ACCESS_TOKEN_TYPE = "accessToken";
+
+ public static final String REFRESH_TOKEN_TYPE = "refreshToken";
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/dto/DicDistrict.java b/internal-common/src/main/java/com/mashibing/common/dto/DicDistrict.java
new file mode 100644
index 0000000..fd8b338
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/dto/DicDistrict.java
@@ -0,0 +1,16 @@
+package com.mashibing.common.dto;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:08
+ */
+@Data
+public class DicDistrict {
+ private String addressCode;
+ private String addressName;
+ private String parentAddressCode;
+ private Integer level;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/dto/DriverUser.java b/internal-common/src/main/java/com/mashibing/common/dto/DriverUser.java
new file mode 100644
index 0000000..8ca883c
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/dto/DriverUser.java
@@ -0,0 +1,46 @@
+package com.mashibing.common.dto;
+
+import lombok.Data;
+
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:09
+ */
+@Data
+public class DriverUser {
+
+ private Long id;
+ private String address;
+ private String driverName;
+ private String driverPhone;
+ private Integer driverGender;
+ private LocalDate driverBirthday;
+ private String driverNation;
+ private String driverContactAddress;
+ private String licenseId;
+
+ private LocalDate getDriverLicenseDate;
+ private LocalDate driverLicenseOn;
+ private LocalDate driverLicenseOff;
+ private Integer taxiDriver;
+ private String certificateNo;
+ private String networkCarIssueOrganization;
+ private LocalDate networkCarIssueDate;
+ private LocalDate getNetworkCarProofDate;
+ private LocalDate networkCarProofOn;
+ private LocalDate networkCarProofOff;
+ private LocalDate registerDate;
+ private Integer commercialType;
+ private String contractCompany;
+ private LocalDate contractOn;
+ private LocalDate contractOff;
+ private Integer state;
+
+
+ private LocalDateTime gmtCreate;
+ private LocalDateTime gmtModified;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/dto/PassengerUser.java b/internal-common/src/main/java/com/mashibing/common/dto/PassengerUser.java
new file mode 100644
index 0000000..20cc72d
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/dto/PassengerUser.java
@@ -0,0 +1,27 @@
+package com.mashibing.common.dto;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:10
+ */
+public class PassengerUser {
+
+ private Long id;
+
+ private LocalDateTime gmtCreate;
+
+ private LocalDateTime gmtModified;
+
+ private String passengerPhone;
+
+ private String passengerName;
+
+ private byte passengerGender;
+
+ private byte state;
+
+ private String profilePhoto;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/dto/PriceRule.java b/internal-common/src/main/java/com/mashibing/common/dto/PriceRule.java
new file mode 100644
index 0000000..b5cf0ab
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/dto/PriceRule.java
@@ -0,0 +1,20 @@
+package com.mashibing.common.dto;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:10
+ */
+public class PriceRule {
+ private String cityCode;
+
+ private String vehicleType;
+
+ private Double startFare;
+
+ private Integer startMile;
+
+ private Double unitPricePerMile;
+
+ private Double unitPricePerMinute;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/dto/ResponseResult.java b/internal-common/src/main/java/com/mashibing/common/dto/ResponseResult.java
new file mode 100644
index 0000000..c5f1406
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/dto/ResponseResult.java
@@ -0,0 +1,74 @@
+package com.mashibing.common.dto;
+
+import com.mashibing.common.constant.CommonStatusEnum;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 22:09
+ */
+@Data
+@Accessors(chain = true)
+public class ResponseResult {
+
+ private int code;
+ private String message;
+ private T data;
+
+ /**
+ * 成功响应的方法
+ *
+ * @param
+ * @return
+ */
+ public static ResponseResult success() {
+ return new ResponseResult().setCode(CommonStatusEnum.SUCCESS.getCode()).setMessage(CommonStatusEnum.SUCCESS.getValue());
+ }
+
+ /**
+ * 成功响应的方法
+ *
+ * @param data
+ * @param
+ * @return
+ */
+ public static ResponseResult success(T data) {
+ return new ResponseResult().setCode(CommonStatusEnum.SUCCESS.getCode()).setMessage(CommonStatusEnum.SUCCESS.getValue()).setData(data);
+ }
+
+ /**
+ * 失败:统一的失败
+ *
+ * @param data
+ * @param
+ * @return
+ */
+ public static ResponseResult fail(T data) {
+ return new ResponseResult().setData(data);
+ }
+
+ /**
+ * 失败:自定义失败 错误码和提示信息
+ *
+ * @param code
+ * @param message
+ * @return
+ */
+ public static ResponseResult fail(int code, String message) {
+ return new ResponseResult().setCode(code).setMessage(message);
+ }
+
+ /**
+ * 失败:自定义失败 错误码、提示信息、具体错误
+ *
+ * @param code
+ * @param message
+ * @param data
+ * @return
+ */
+ public static ResponseResult fail(int code, String message, String data) {
+ return new ResponseResult().setCode(code).setMessage(message).setData(data);
+ }
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/dto/TokenResult.java b/internal-common/src/main/java/com/mashibing/common/dto/TokenResult.java
new file mode 100644
index 0000000..5c2911d
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/dto/TokenResult.java
@@ -0,0 +1,14 @@
+package com.mashibing.common.dto;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 23:37
+ */
+@Data
+public class TokenResult {
+ private String phone;
+ private String identity;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/request/ForecastPriceDTO.java b/internal-common/src/main/java/com/mashibing/common/request/ForecastPriceDTO.java
new file mode 100644
index 0000000..eb85d18
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/request/ForecastPriceDTO.java
@@ -0,0 +1,16 @@
+package com.mashibing.common.request;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:08
+ */
+@Data
+public class ForecastPriceDTO {
+ private String depLongitude;
+ private String depLatitude;
+ private String destLongitude;
+ private String destLatitude;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/request/VerificationCodeDTO.java b/internal-common/src/main/java/com/mashibing/common/request/VerificationCodeDTO.java
new file mode 100644
index 0000000..5b4388c
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/request/VerificationCodeDTO.java
@@ -0,0 +1,14 @@
+package com.mashibing.common.request;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:08
+ */
+@Data
+public class VerificationCodeDTO {
+ private String passengerPhone;
+ private String verificationCode;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/response/DirectionResponse.java b/internal-common/src/main/java/com/mashibing/common/response/DirectionResponse.java
new file mode 100644
index 0000000..2cd43b0
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/response/DirectionResponse.java
@@ -0,0 +1,14 @@
+package com.mashibing.common.response;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:07
+ */
+@Data
+public class DirectionResponse {
+ private Integer distance;
+ private Integer duration;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/response/ForecastPriceResponse.java b/internal-common/src/main/java/com/mashibing/common/response/ForecastPriceResponse.java
new file mode 100644
index 0000000..d22aaf6
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/response/ForecastPriceResponse.java
@@ -0,0 +1,13 @@
+package com.mashibing.common.response;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:07
+ */
+@Data
+public class ForecastPriceResponse {
+ private double price;
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/response/NumberCodeResponse.java b/internal-common/src/main/java/com/mashibing/common/response/NumberCodeResponse.java
new file mode 100644
index 0000000..6fd69fa
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/response/NumberCodeResponse.java
@@ -0,0 +1,13 @@
+package com.mashibing.common.response;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:05
+ */
+@Data
+public class NumberCodeResponse {
+ private int numberCode;
+}
\ No newline at end of file
diff --git a/internal-common/src/main/java/com/mashibing/common/response/TokenResponse.java b/internal-common/src/main/java/com/mashibing/common/response/TokenResponse.java
new file mode 100644
index 0000000..eb60318
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/response/TokenResponse.java
@@ -0,0 +1,14 @@
+package com.mashibing.common.response;
+
+import lombok.Data;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:06
+ */
+@Data
+public class TokenResponse {
+ private String accessToken;
+ private String refreshToken;
+}
\ No newline at end of file
diff --git a/internal-common/src/main/java/com/mashibing/common/util/BigDecimalUtils.java b/internal-common/src/main/java/com/mashibing/common/util/BigDecimalUtils.java
new file mode 100644
index 0000000..417e55a
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/util/BigDecimalUtils.java
@@ -0,0 +1,69 @@
+package com.mashibing.common.util;
+
+import java.math.BigDecimal;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 22:54
+ */
+public class BigDecimalUtils {
+
+ /**
+ * 加法
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public static double add(double v1, double v2) {
+ BigDecimal b1 = BigDecimal.valueOf(v1);
+ BigDecimal b2 = BigDecimal.valueOf(v2);
+
+ return b1.add(b2).doubleValue();
+ }
+
+ /**
+ * 减法
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public static double subtract(double v1, double v2) {
+ BigDecimal b1 = BigDecimal.valueOf(v1);
+ BigDecimal b2 = BigDecimal.valueOf(v2);
+ return b1.subtract(b2).doubleValue();
+ }
+
+ /**
+ * 乘法
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public static double multiply(double v1, double v2) {
+ BigDecimal b1 = BigDecimal.valueOf(v1);
+ BigDecimal b2 = BigDecimal.valueOf(v2);
+ return b1.multiply(b2).doubleValue();
+
+ }
+
+ /**
+ * 除法
+ *
+ * @param v1
+ * @param v2
+ * @return
+ */
+ public static double divide(int v1, int v2) {
+ if (v2 <= 0) {
+ throw new IllegalArgumentException("除数非法");
+ }
+
+ BigDecimal b1 = BigDecimal.valueOf(v1);
+ BigDecimal b2 = BigDecimal.valueOf(v2);
+ return b1.divide(b2, 2, BigDecimal.ROUND_HALF_UP).doubleValue();
+ }
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/util/JwtUtils.java b/internal-common/src/main/java/com/mashibing/common/util/JwtUtils.java
new file mode 100644
index 0000000..309c575
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/util/JwtUtils.java
@@ -0,0 +1,112 @@
+package com.mashibing.common.util;
+
+import com.auth0.jwt.JWT;
+import com.auth0.jwt.JWTCreator;
+import com.auth0.jwt.algorithms.Algorithm;
+import com.auth0.jwt.interfaces.DecodedJWT;
+import com.mashibing.common.dto.TokenResult;
+
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 23:12
+ */
+public class JwtUtils {
+ /**
+ * 盐值 salt
+ */
+ private static final String SIGN = "CPFsb!@#$$";
+
+ private static final String JWT_KEY_PHONE = "phone";
+
+ /**
+ * 乘客是1,司机是2
+ */
+ private static final String JWT_KEY_IDENTITY = "identity";
+
+ /**
+ * token类型
+ */
+ private static final String JWT_TOKEN_TYPE = "tokenType";
+
+ private static final String JWT_TOKEN_TIME = "tokenTime";
+
+ /**
+ * 生成token
+ * @param passengerPhone
+ * @param identity
+ * @param tokenType
+ * @return
+ */
+ public static String generatorToken(String passengerPhone, String identity, String tokenType) {
+ Map map = new HashMap<>();
+ map.put(JWT_KEY_PHONE, passengerPhone);
+ map.put(JWT_KEY_IDENTITY, identity);
+ map.put(JWT_TOKEN_TYPE, tokenType);
+ // 防止每次生成的token一样。
+ map.put(JWT_TOKEN_TIME, Calendar.getInstance().getTime().toString());
+
+ JWTCreator.Builder builder = JWT.create();
+ // 整合map
+ map.forEach(
+ (k, v) -> {
+ builder.withClaim(k, v);
+ }
+ );
+ // 整合过期时间
+// builder.withExpiresAt(date);
+
+ // 生成 token
+ String sign = builder.sign(Algorithm.HMAC256(SIGN));
+
+ return sign;
+ }
+
+
+ /**
+ * 解析token
+ * @param token
+ * @return
+ */
+ public static TokenResult parseToken(String token) {
+ DecodedJWT verify = JWT.require(Algorithm.HMAC256(SIGN)).build().verify(token);
+ String phone = verify.getClaim(JWT_KEY_PHONE).asString();
+ String identity = verify.getClaim(JWT_KEY_IDENTITY).asString();
+
+ TokenResult tokenResult = new TokenResult();
+ tokenResult.setPhone(phone);
+ tokenResult.setIdentity(identity);
+ return tokenResult;
+
+ }
+
+ /**
+ * 校验token,主要判断token是否异常
+ *
+ * @param token
+ * @return
+ */
+ public static TokenResult checkToken(String token) {
+ TokenResult tokenResult = null;
+ try {
+ tokenResult = JwtUtils.parseToken(token);
+ } catch (Exception e) {
+
+ }
+ return tokenResult;
+ }
+
+ public static void main(String[] args) {
+
+ String s = generatorToken("13910733521", "1", "accessToken");
+ System.out.println("生成的token:" + s);
+ System.out.println("解析-----------------");
+ TokenResult tokenResult = parseToken(s);
+ System.out.println("手机号:" + tokenResult.getPhone());
+ System.out.println("身份:" + tokenResult.getIdentity());
+ }
+}
diff --git a/internal-common/src/main/java/com/mashibing/common/util/RedisPrefixUtils.java b/internal-common/src/main/java/com/mashibing/common/util/RedisPrefixUtils.java
new file mode 100644
index 0000000..ac2156e
--- /dev/null
+++ b/internal-common/src/main/java/com/mashibing/common/util/RedisPrefixUtils.java
@@ -0,0 +1,39 @@
+package com.mashibing.common.util;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 23:05
+ */
+public class RedisPrefixUtils {
+ /**
+ * 乘客验证码的前缀
+ */
+ public static String verificationCodePrefix = "passenger-verification-code-";
+
+ /**
+ * token存储的前缀
+ */
+ public static String tokenPrefix = "token-";
+
+ /**
+ * 根据手机号,生成key
+ *
+ * @param passengerPhone
+ * @return
+ */
+ public static String generatorKeyByPhone(String passengerPhone) {
+ return verificationCodePrefix + passengerPhone;
+ }
+
+ /**
+ * 根据手机号和身份标识,生成token
+ *
+ * @param phone
+ * @param identity
+ * @return
+ */
+ public static String generatorTokenKey(String phone, String identity, String tokenType) {
+ return tokenPrefix + phone + "-" + identity + "-" + tokenType;
+ }
+}
diff --git a/pom.xml b/pom.xml
index 673fb62..8220d8c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,14 @@
1.0-SNAPSHOT
api-passenger
+ service-verificationcode
+ service-driver-user
+ service-passenger-user
+ service-map
+ service-price
+ api-boss
+ api-driver
+ internal-common
pom
@@ -34,5 +42,36 @@
org.projectlombok
lombok
+
+ com.auth0
+ java-jwt
+ 3.14.0
+
+
+
+ com.mashibing
+ internal-common
+ 1.0-SNAPSHOT
+
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-alibaba-dependencies
+ 2021.1
+ pom
+ import
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ 2020.0.1
+ pom
+ import
+
+
+
\ No newline at end of file
diff --git a/service-driver-user/pom.xml b/service-driver-user/pom.xml
new file mode 100644
index 0000000..44b69da
--- /dev/null
+++ b/service-driver-user/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-driver-user
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/service-map/pom.xml b/service-map/pom.xml
new file mode 100644
index 0000000..62fc332
--- /dev/null
+++ b/service-map/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-map
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/service-passenger-user/pom.xml b/service-passenger-user/pom.xml
new file mode 100644
index 0000000..0cebf39
--- /dev/null
+++ b/service-passenger-user/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-passenger-user
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/service-price/pom.xml b/service-price/pom.xml
new file mode 100644
index 0000000..e17d42a
--- /dev/null
+++ b/service-price/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-price
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/service-verificationcode/pom.xml b/service-verificationcode/pom.xml
new file mode 100644
index 0000000..2c0af49
--- /dev/null
+++ b/service-verificationcode/pom.xml
@@ -0,0 +1,36 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ service-verificationcode
+
+
+ 8
+ 8
+
+
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
\ No newline at end of file
diff --git a/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/VerificationCodeApplication.java b/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/VerificationCodeApplication.java
new file mode 100644
index 0000000..ccf7d72
--- /dev/null
+++ b/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/VerificationCodeApplication.java
@@ -0,0 +1,19 @@
+package com.mashibing.service.verificationcode;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:13
+ */
+@SpringBootApplication
+@EnableDiscoveryClient
+public class VerificationCodeApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(VerificationCodeApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/controller/NumberCodeController.java b/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/controller/NumberCodeController.java
new file mode 100644
index 0000000..e4d995e
--- /dev/null
+++ b/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/controller/NumberCodeController.java
@@ -0,0 +1,32 @@
+package com.mashibing.service.verificationcode.controller;
+
+import com.mashibing.common.dto.ResponseResult;
+import com.mashibing.common.response.NumberCodeResponse;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/25 21:47
+ */
+@RestController
+public class NumberCodeController {
+
+ @GetMapping("/numberCode/{size}")
+ public ResponseResult numberCode(@PathVariable("size") int size) {
+ System.out.println("size:" + size);
+ // 生成验证码
+ double mathRandom = (Math.random() * 9 + 1) * (Math.pow(10, size - 1));
+ System.out.println(mathRandom);
+ int resultInt = (int) mathRandom;
+ System.out.println("generator src code:" + resultInt);
+
+ // 定义返回值
+ NumberCodeResponse response = new NumberCodeResponse();
+ response.setNumberCode(resultInt);
+
+ return ResponseResult.success(response);
+ }
+}
diff --git a/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/controller/TestController.java b/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/controller/TestController.java
new file mode 100644
index 0000000..63bef1b
--- /dev/null
+++ b/service-verificationcode/src/main/java/com/mashibing/service/verificationcode/controller/TestController.java
@@ -0,0 +1,18 @@
+package com.mashibing.service.verificationcode.controller;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author fangyu
+ * @version v1.0.0
+ * @date 2022/7/26 00:13
+ */
+@RestController
+public class TestController {
+
+ @GetMapping("/test")
+ public String test(){
+ return "service-verificationcode";
+ }
+}
\ No newline at end of file
diff --git a/service-verificationcode/src/main/resources/application.yml b/service-verificationcode/src/main/resources/application.yml
new file mode 100644
index 0000000..28180e0
--- /dev/null
+++ b/service-verificationcode/src/main/resources/application.yml
@@ -0,0 +1,9 @@
+server:
+ port: 8082
+spring:
+ cloud:
+ nacos:
+ discovery:
+ server-addr: 127.0.0.1:8848
+ application:
+ name: service-verificationcode
\ No newline at end of file