Compare commits

...

2 Commits

Author SHA1 Message Date
topsun 514bd7bb8c 创建轨迹
2 years ago
topsun 54c64cb863 service-driver-user初始化轨迹代码完成
2 years ago

@ -2,6 +2,7 @@ package com.taxi.servicedriveruser.remote;
import com.internal.dto.ResponseResult; import com.internal.dto.ResponseResult;
import com.internal.dto.TerminalResponse; import com.internal.dto.TerminalResponse;
import com.internal.dto.TrackResponse;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
@ -12,4 +13,7 @@ public interface ServiceMapClient {
@RequestMapping(method = RequestMethod.POST,value = "/terminal/addTerminal") @RequestMapping(method = RequestMethod.POST,value = "/terminal/addTerminal")
ResponseResult<TerminalResponse> addTerminal(@RequestParam String name); 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.Car;
import com.internal.dto.ResponseResult; import com.internal.dto.ResponseResult;
import com.internal.dto.TerminalResponse; import com.internal.dto.TerminalResponse;
import com.internal.dto.TrackResponse;
import com.taxi.servicedriveruser.mapper.CarMapper; import com.taxi.servicedriveruser.mapper.CarMapper;
import com.taxi.servicedriveruser.remote.ServiceMapClient; import com.taxi.servicedriveruser.remote.ServiceMapClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -29,8 +30,11 @@ public class CarService {
car.setTid(tid); car.setTid(tid);
//获得此车辆的轨迹id,trid //获得此车辆的轨迹id,trid
ResponseResult<TrackResponse> trackResult = serviceMapClient.addTrack(tid);
String trid = trackResult.getData().getTrid();
String trname = trackResult.getData().getTrname();
car.setTrid(trid);
car.setTrname(trname);
carMapper.insert(car); carMapper.insert(car);

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

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

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

Loading…
Cancel
Save