飞滴出行网约车2022-api-boss调用service-driver-user实现司机信息修改以及新增扩展修改

master
yh 3 years ago
parent 19e3848acf
commit d2e722377b

@ -3,8 +3,10 @@ package com.mashibing.apiboss.controller;
import com.mashibing.apiboss.service.UserService;
import com.mashibing.internalcommon.dto.DriverUser;
import com.mashibing.internalcommon.dto.ResponseResult;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@ -15,9 +17,28 @@ public class DriverUserController {
@Autowired
private UserService service;
/**
*
* @param driverUser
* @return
*/
@PostMapping("/driver-user")
public ResponseResult saveDriverUser(@RequestBody DriverUser driverUser){
// 接口扩展
if(driverUser.getId() != null && driverUser.getId() > 0){
return service.updateDriverUser(driverUser);
}
return service.saveDriverUser(driverUser);
}
/**
*
* @param driverUser
* @return
*/
@PutMapping("/driver-user")
public ResponseResult updateDriverUser(@RequestBody DriverUser driverUser){
return service.updateDriverUser(driverUser);
}
}

@ -5,6 +5,7 @@ import com.mashibing.internalcommon.dto.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
@Service
@ -14,4 +15,7 @@ public interface ServiceDriverUserClient {
@PostMapping("/user")
public ResponseResult saveUser(@RequestBody DriverUser driverUser);
@PutMapping("/user")
public ResponseResult updateUser(@RequestBody DriverUser driverUser);
}

@ -13,8 +13,11 @@ public class UserService {
private ServiceDriverUserClient client;
public ResponseResult saveDriverUser(DriverUser driverUser){
return client.saveUser(driverUser);
}
public ResponseResult updateDriverUser(DriverUser driverUser){
return client.updateUser(driverUser);
}
}

Loading…
Cancel
Save