新建service-passenger-user项目

master
liuyuanqiang 2 years ago
parent e20bc551f0
commit e5731ae528

@ -7,8 +7,9 @@
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="api-passenger" />
<module name="internal-common" /> <module name="internal-common" />
<module name="api-passenger" />
<module name="service-passenger-user" />
<module name="service-verificationcode" /> <module name="service-verificationcode" />
</profile> </profile>
</annotationProcessing> </annotationProcessing>
@ -17,6 +18,7 @@
<option name="ADDITIONAL_OPTIONS_OVERRIDE"> <option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="api-passenger" options="-parameters" /> <module name="api-passenger" options="-parameters" />
<module name="internal-common" options="-parameters" /> <module name="internal-common" options="-parameters" />
<module name="service-passenger-user" options="-parameters" />
<module name="service-verificationcode" options="-parameters" /> <module name="service-verificationcode" options="-parameters" />
</option> </option>
</component> </component>

@ -3,6 +3,7 @@
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8"> <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="file://$PROJECT_DIR$/api-passenger/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/api-passenger/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/internal-common/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/internal-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/service-passenger-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/service-verificationcode/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/service-verificationcode/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />

@ -1,10 +1,12 @@
package com.mashibing.apipassenger.service; package com.mashibing.apipassenger.service;
import com.mashibing.apipassenger.remote.ServiceVefificationcodeClient; import com.mashibing.apipassenger.remote.ServiceVefificationcodeClient;
import com.mashibing.common.constant.CommonStatusEnum;
import com.mashibing.common.dto.ResponseResult; import com.mashibing.common.dto.ResponseResult;
import com.mashibing.common.response.NumberCodeResponse; import com.mashibing.common.response.NumberCodeResponse;
import com.mashibing.common.response.TokenResponse; import com.mashibing.common.response.TokenResponse;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -24,7 +26,7 @@ public class VerificationCodeService {
/** /**
* *
* @param passengerPhone * @param passengerPhone
* @return * @return ResponseResult
*/ */
public ResponseResult generatorCode(String passengerPhone){ public ResponseResult generatorCode(String passengerPhone){
//调用验证码服务,获取验证码 //调用验证码服务,获取验证码
@ -51,7 +53,7 @@ public class VerificationCodeService {
* *
* @param passengerPhone * @param passengerPhone
* @param verificationCode * @param verificationCode
* @return * @return ResponseResult
*/ */
public ResponseResult checkCode(String passengerPhone, String verificationCode) { public ResponseResult checkCode(String passengerPhone, String verificationCode) {
System.out.println("根据手机号和验证码查询redis"); System.out.println("根据手机号和验证码查询redis");
@ -60,7 +62,12 @@ public class VerificationCodeService {
System.out.println("code in redis:" + codeRedis); System.out.println("code in redis:" + codeRedis);
System.out.println("校验验证码"); System.out.println("校验验证码");
if(StringUtils.isBlank(codeRedis)){
return ResponseResult.fail(CommonStatusEnum.VERIFICATION_CODE_FAIL.getCode(),CommonStatusEnum.VERIFICATION_CODE_FAIL.getMsg());
}
if(!verificationCode.trim().equals(codeRedis.trim())){
return ResponseResult.fail(CommonStatusEnum.VERIFICATION_CODE_FAIL.getCode(),CommonStatusEnum.VERIFICATION_CODE_FAIL.getMsg());
}
System.out.println("判断是否有用户,没有则新增用户"); System.out.println("判断是否有用户,没有则新增用户");
System.out.println("颁发token"); System.out.println("颁发token");

@ -4,6 +4,11 @@ import lombok.Data;
import lombok.Getter; import lombok.Getter;
public enum CommonStatusEnum { public enum CommonStatusEnum {
/**
*
*/
VERIFICATION_CODE_FAIL(1001,"验证码错误!"),
/** /**
* *
*/ */
@ -12,6 +17,7 @@ public enum CommonStatusEnum {
* *
*/ */
FAIL(0,"fail"); FAIL(0,"fail");
@Getter @Getter
private int code; private int code;
@Getter @Getter

@ -18,6 +18,7 @@
<module>api-passenger</module> <module>api-passenger</module>
<module>service-verificationcode</module> <module>service-verificationcode</module>
<module>internal-common</module> <module>internal-common</module>
<module>service-passenger-user</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>

@ -0,0 +1,30 @@
<?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>org.mashibing</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>service-passenger-user</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-commons</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,13 @@
package com.mashibing.serviceDriverUser;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class ServicePassengerUserApplication {
public static void main(String[] args) {
SpringApplication.run(ServicePassengerUserApplication.class);
}
}

@ -0,0 +1,14 @@
package com.mashibing.serviceDriverUser.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
public class TestController {
@GetMapping
public String test(){
return "service-passenger-user";
}
}
Loading…
Cancel
Save