service-driver-user初始化轨迹代码完成

main
topsun 2 years ago
parent 08c2365411
commit 54c64cb863

@ -2,6 +2,7 @@ package com.taxi.servicedriveruser.remote;
import com.internal.dto.ResponseResult;
import com.internal.dto.TerminalResponse;
import com.internal.dto.TrackResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -12,4 +13,7 @@ public interface ServiceMapClient {
@RequestMapping(method = RequestMethod.POST,value = "/terminal/addTerminal")
ResponseResult<TerminalResponse> addTerminal(@RequestParam String name);
@RequestMapping(method = RequestMethod.POST,value = "/track/addTrack")
ResponseResult<TrackResponse> addTrack(@RequestParam String tid);
}

@ -3,6 +3,7 @@ package com.taxi.servicedriveruser.service;
import com.internal.dto.Car;
import com.internal.dto.ResponseResult;
import com.internal.dto.TerminalResponse;
import com.internal.dto.TrackResponse;
import com.taxi.servicedriveruser.mapper.CarMapper;
import com.taxi.servicedriveruser.remote.ServiceMapClient;
import org.springframework.beans.factory.annotation.Autowired;
@ -29,8 +30,9 @@ public class CarService {
car.setTid(tid);
//获得此车辆的轨迹id,trid
ResponseResult<TrackResponse> trackResult = serviceMapClient.addTrack(tid);
String trid = trackResult.getData().getTrid();
car.setTid(trid);
carMapper.insert(car);

@ -1,6 +1,7 @@
package com.taxi.servicemap.controller;
import com.internal.dto.ResponseResult;
import com.internal.dto.TrackResponse;
import com.taxi.servicemap.service.TrackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -15,7 +16,7 @@ public class TrackController {
private TrackService trackService;
@PostMapping("/addTrack")
public ResponseResult addTrack(String tid){
public ResponseResult<TrackResponse> addTrack(String tid){
return trackService.addTrack(tid);
}
}

@ -22,7 +22,7 @@ public class TrackClient {
private RestTemplate restTemplate;
public ResponseResult addTrack(String tid){
public ResponseResult<TrackResponse> addTrack(String tid){
//拼接请求的URL
StringBuilder url = new StringBuilder();
url.append(AmapConfigConstant.TRACK_MAP_ADD_URL);

@ -1,6 +1,7 @@
package com.taxi.servicemap.service;
import com.internal.dto.ResponseResult;
import com.internal.dto.TrackResponse;
import com.taxi.servicemap.remote.TrackClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -10,7 +11,7 @@ public class TrackService {
@Autowired
private TrackClient trackClient;
public ResponseResult addTrack(String tid){
public ResponseResult<TrackResponse> addTrack(String tid){
return trackClient.addTrack(tid);
}
}

Loading…
Cancel
Save