飞滴出行网约车2022-乘客用户服务骨架代码编写

master
yh 3 years ago
parent ef809e0737
commit 26d24ed5f9

@ -27,14 +27,6 @@
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.mashibing</groupId>
<artifactId>internal-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>

@ -1,7 +1,6 @@
package com.mashibing.apipassenger.controller; package com.mashibing.apipassenger.controller;
import com.mashibing.apipassenger.remote.ServiceVerificationcodeClient; import com.mashibing.internalcommon.request.VerificationCodeDTO;
import com.mashibing.apipassenger.request.VerificationCodeDTO;
import com.mashibing.apipassenger.service.VerificationCodeService; import com.mashibing.apipassenger.service.VerificationCodeService;
import com.mashibing.internalcommon.dto.ResponseResult; import com.mashibing.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;

@ -1,4 +1,4 @@
package com.mashibing.apipassenger.request; package com.mashibing.internalcommon.request;
import lombok.Data; import lombok.Data;

@ -31,9 +31,10 @@
<dependencyManagement> <dependencyManagement>
<dependencies>
<!-- springboot版本 2.4.2 匹配 各版本 --> <!-- springboot版本 2.4.2 匹配 各版本 -->
<!-- https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E --> <!-- https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E -->
<dependencies>
<dependency> <dependency>
<groupId>com.alibaba.cloud</groupId> <groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId> <artifactId>spring-cloud-alibaba-dependencies</artifactId>
@ -41,7 +42,6 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId> <artifactId>spring-cloud-dependencies</artifactId>
@ -49,11 +49,17 @@
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<dependencies> <dependencies>
<dependency>
<groupId>com.mashibing</groupId>
<artifactId>internal-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency> <dependency>
<groupId>net.sf.json-lib</groupId> <groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId> <artifactId>json-lib</artifactId>

@ -0,0 +1,29 @@
package com.mashibing.servicepassengeruser.controller;
import com.mashibing.internalcommon.dto.ResponseResult;
import com.mashibing.internalcommon.request.VerificationCodeDTO;
import com.mashibing.servicepassengeruser.service.UserService;
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.RestController;
@RestController
public class UserController {
@Autowired
private UserService service;
@PostMapping("/user")
public ResponseResult loginOrReg(@RequestBody VerificationCodeDTO verificationCodeDTO){
String passengerPhone = verificationCodeDTO.getPassengerPhone();
System.out.println("手机号:"+passengerPhone);
// 调用接口实现
service.loginOrRegister(passengerPhone);
return ResponseResult.success("");
}
}

@ -0,0 +1,21 @@
package com.mashibing.servicepassengeruser.service;
import com.mashibing.internalcommon.dto.ResponseResult;
import org.springframework.stereotype.Service;
@Service
public class UserService {
public ResponseResult loginOrRegister(String passengerPhone){
System.out.println("user service 被调用,手机号码为:"+passengerPhone);
//根据手机号查询用户信息
//判断用户信息是否存在
//如果不存在,插入用户信息
return ResponseResult.success();
}
}

@ -39,13 +39,6 @@
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId> <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.mashibing</groupId>
<artifactId>internal-common</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

Loading…
Cancel
Save