parent
d2e722377b
commit
9c0dc23696
@ -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/
|
@ -0,0 +1,34 @@
|
|||||||
|
<?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>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- feign 组件 基于 loadbalancer 依赖-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-loadbalancer</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
server:
|
||||||
|
port: 8088
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
name: api-driver
|
||||||
|
cloud:
|
||||||
|
nacos:
|
||||||
|
discovery:
|
||||||
|
server-addr: localhost:8848
|
Loading…
Reference in new issue