From 9c0dc23696eab2ada1529eeda8b3581696b2322f Mon Sep 17 00:00:00 2001
From: yh <1844516659@qq.com>
Date: Tue, 19 Jul 2022 19:21:08 +0800
Subject: [PATCH] =?UTF-8?q?=E9=A3=9E=E6=BB=B4=E5=87=BA=E8=A1=8C=E7=BD=91?=
=?UTF-8?q?=E7=BA=A6=E8=BD=A62022-api-driver=E8=B0=83=E7=94=A8service-driv?=
=?UTF-8?q?er-user=E5=AE=9E=E7=8E=B0=E5=8F=B8=E6=9C=BA=E4=BF=A1=E6=81=AF?=
=?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
api-driver/.gitignore | 48 +++++++++++++++++++
api-driver/pom.xml | 34 +++++++++++++
.../apidriver/ApiDriverApplication.java | 15 ++++++
.../controller/DriverUserController.java | 27 +++++++++++
.../apidriver/controller/TestControler.java | 18 +++++++
.../remote/ServiceDriverUserClient.java | 17 +++++++
.../apidriver/service/UserSerive.java | 19 ++++++++
api-driver/src/main/resources/application.yml | 9 ++++
pom.xml | 1 +
项目端口预设.md | 3 +-
10 files changed, 190 insertions(+), 1 deletion(-)
create mode 100644 api-driver/.gitignore
create mode 100644 api-driver/pom.xml
create mode 100644 api-driver/src/main/java/com/mashibing/apidriver/ApiDriverApplication.java
create mode 100644 api-driver/src/main/java/com/mashibing/apidriver/controller/DriverUserController.java
create mode 100644 api-driver/src/main/java/com/mashibing/apidriver/controller/TestControler.java
create mode 100644 api-driver/src/main/java/com/mashibing/apidriver/remote/ServiceDriverUserClient.java
create mode 100644 api-driver/src/main/java/com/mashibing/apidriver/service/UserSerive.java
create mode 100644 api-driver/src/main/resources/application.yml
diff --git a/api-driver/.gitignore b/api-driver/.gitignore
new file mode 100644
index 0000000..bdd28b0
--- /dev/null
+++ b/api-driver/.gitignore
@@ -0,0 +1,48 @@
+# .gitignore
+
+### IntelliJ IDEA Project ###
+.idea
+*.iws
+*.iml
+*.ipr
+/.idea
+target
+src/test/
+!**/src/test/**/target/
+#!**/src/main/**/target/
+
+### Maven template
+HELP.md
+README.md
+.mvn
+mvnw
+mvnw.cmd
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+timing.properties
+#.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+build/
+
+### VS Code ###
+.vscode/
diff --git a/api-driver/pom.xml b/api-driver/pom.xml
new file mode 100644
index 0000000..1c84256
--- /dev/null
+++ b/api-driver/pom.xml
@@ -0,0 +1,34 @@
+
+
+
+ online-taxi-public
+ com.mashibing
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ api-driver
+
+
+
+ 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-driver/src/main/java/com/mashibing/apidriver/ApiDriverApplication.java b/api-driver/src/main/java/com/mashibing/apidriver/ApiDriverApplication.java
new file mode 100644
index 0000000..d45b824
--- /dev/null
+++ b/api-driver/src/main/java/com/mashibing/apidriver/ApiDriverApplication.java
@@ -0,0 +1,15 @@
+package com.mashibing.apidriver;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+
+@SpringBootApplication
+@EnableDiscoveryClient
+@EnableFeignClients
+public class ApiDriverApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(ApiDriverApplication.class);
+ }
+}
diff --git a/api-driver/src/main/java/com/mashibing/apidriver/controller/DriverUserController.java b/api-driver/src/main/java/com/mashibing/apidriver/controller/DriverUserController.java
new file mode 100644
index 0000000..2806048
--- /dev/null
+++ b/api-driver/src/main/java/com/mashibing/apidriver/controller/DriverUserController.java
@@ -0,0 +1,27 @@
+package com.mashibing.apidriver.controller;
+
+import com.mashibing.apidriver.service.UserSerive;
+import com.mashibing.internalcommon.dto.DriverUser;
+import com.mashibing.internalcommon.dto.ResponseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class DriverUserController {
+
+ @Autowired
+ private UserSerive serive;
+
+ /**
+ * 修改 司机 用户信息
+ * @param driverUser
+ * @return
+ */
+ @PutMapping("/driver-user")
+ public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser){
+ return serive.updateDriverUser(driverUser);
+ }
+
+}
diff --git a/api-driver/src/main/java/com/mashibing/apidriver/controller/TestControler.java b/api-driver/src/main/java/com/mashibing/apidriver/controller/TestControler.java
new file mode 100644
index 0000000..a2bcb6d
--- /dev/null
+++ b/api-driver/src/main/java/com/mashibing/apidriver/controller/TestControler.java
@@ -0,0 +1,18 @@
+package com.mashibing.apidriver.controller;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+public class TestControler {
+
+ @Value("${spring.application.name}")
+ private String serviceName;
+
+ @GetMapping("/")
+ public String test() {
+ return serviceName;
+ }
+
+}
diff --git a/api-driver/src/main/java/com/mashibing/apidriver/remote/ServiceDriverUserClient.java b/api-driver/src/main/java/com/mashibing/apidriver/remote/ServiceDriverUserClient.java
new file mode 100644
index 0000000..a2ab85f
--- /dev/null
+++ b/api-driver/src/main/java/com/mashibing/apidriver/remote/ServiceDriverUserClient.java
@@ -0,0 +1,17 @@
+package com.mashibing.apidriver.remote;
+
+import com.mashibing.internalcommon.dto.DriverUser;
+import com.mashibing.internalcommon.dto.ResponseResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+@Service
+@FeignClient("service-driver-user")
+public interface ServiceDriverUserClient {
+
+ @PutMapping("/user")
+ public ResponseResult updateUser(@RequestBody DriverUser driverUser);
+
+}
diff --git a/api-driver/src/main/java/com/mashibing/apidriver/service/UserSerive.java b/api-driver/src/main/java/com/mashibing/apidriver/service/UserSerive.java
new file mode 100644
index 0000000..78d2392
--- /dev/null
+++ b/api-driver/src/main/java/com/mashibing/apidriver/service/UserSerive.java
@@ -0,0 +1,19 @@
+package com.mashibing.apidriver.service;
+
+import com.mashibing.apidriver.remote.ServiceDriverUserClient;
+import com.mashibing.internalcommon.dto.DriverUser;
+import com.mashibing.internalcommon.dto.ResponseResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class UserSerive {
+
+ @Autowired
+ private ServiceDriverUserClient client;
+
+ public ResponseResult updateDriverUser(DriverUser driverUser){
+ return client.updateUser(driverUser);
+ }
+
+}
diff --git a/api-driver/src/main/resources/application.yml b/api-driver/src/main/resources/application.yml
new file mode 100644
index 0000000..410aea4
--- /dev/null
+++ b/api-driver/src/main/resources/application.yml
@@ -0,0 +1,9 @@
+server:
+ port: 8088
+spring:
+ application:
+ name: api-driver
+ cloud:
+ nacos:
+ discovery:
+ server-addr: localhost:8848
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ce21e29..a4e784d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,6 +31,7 @@
service-map
service-driver-user
api-boss
+ api-driver
diff --git a/项目端口预设.md b/项目端口预设.md
index 6ef4b72..4a3794e 100644
--- a/项目端口预设.md
+++ b/项目端口预设.md
@@ -6,4 +6,5 @@
| service-price|8084|
|service-map|8085|
|service-driver-user|8086|
-|api-boss|8087|
\ No newline at end of file
+|api-boss|8087|
+|api-driver|8088|
\ No newline at end of file