parent
1d3c48413b
commit
12be01ea87
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>api-boss</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>api-driver</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -1,26 +1,13 @@
|
|||||||
package com.mashibing.passenger.request;
|
package com.mashibing.passenger.request;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author fangyu
|
* @author fangyu
|
||||||
* @version v1.0.0
|
* @version v1.0.0
|
||||||
* @date 2022/7/24 01:21
|
* @date 2022/7/24 01:21
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
public class VerificationCodeDTO {
|
public class VerificationCodeDTO {
|
||||||
|
|
||||||
private String passengerPhone;
|
private String passengerPhone;
|
||||||
|
|
||||||
public String getPassengerPhone() {
|
|
||||||
return passengerPhone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassengerPhone(String passengerPhone) {
|
|
||||||
this.passengerPhone = passengerPhone;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "{\"VerificationCodeDTO\":{"
|
|
||||||
+ " \"passengerPhone\":\"" + passengerPhone + "\""
|
|
||||||
+ "}}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,9 @@
|
|||||||
server:
|
server:
|
||||||
port: 8081
|
port: 8081
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
application:
|
||||||
|
name: api-passenger
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>internal-common</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -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";
|
||||||
|
}
|
@ -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";
|
||||||
|
}
|
@ -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";
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>service-driver-user</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>service-map</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>service-passenger-user</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>service-price</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>online-taxi-public</artifactId>
|
||||||
|
<groupId>com.mashibing</groupId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>service-verificationcode</artifactId>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- add nacos -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
server:
|
||||||
|
port: 8082
|
||||||
|
spring:
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: 127.0.0.1:8848
|
||||||
|
application:
|
||||||
|
name: service-verificationcode
|
Loading…
Reference in new issue