parent
aff628e6cf
commit
22eb0bbcc1
@ -0,0 +1,11 @@
|
||||
package com.mashibing.internalcommon.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DirectionResponse {
|
||||
|
||||
private Integer distance;
|
||||
private Integer duration;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package com.mashibing.servicemap.controller;
|
||||
|
||||
import com.mashibing.internalcommon.dto.ResponseResult;
|
||||
import com.mashibing.internalcommon.request.ForecastPriceDTO;
|
||||
import com.mashibing.servicemap.service.DirectionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/direction")
|
||||
public class DirectionController {
|
||||
|
||||
@Autowired
|
||||
private DirectionService directionService;
|
||||
|
||||
@GetMapping("/driving")
|
||||
public ResponseResult driving(@RequestBody ForecastPriceDTO forecastPriceDTO){
|
||||
|
||||
String depLongitude = forecastPriceDTO. getDepLongitude();
|
||||
String depLatitude = forecastPriceDTO.getDepLatitude();
|
||||
String destLongitude = forecastPriceDTO.getDestLongitude();
|
||||
String destLatitude = forecastPriceDTO.getDestLatitude();
|
||||
|
||||
return directionService.driving(depLongitude,depLatitude,destLongitude,destLatitude);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.mashibing.servicemap.service;
|
||||
|
||||
import com.mashibing.internalcommon.dto.ResponseResult;
|
||||
import com.mashibing.internalcommon.response.DirectionResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DirectionService {
|
||||
|
||||
/**
|
||||
* 根据 出发地和目地的 地经纬度 计算预估价格
|
||||
* @param depLongitude
|
||||
* @param depLatitude
|
||||
* @param destLongitude
|
||||
* @param destLatitude
|
||||
* @return
|
||||
*/
|
||||
public ResponseResult driving(String depLongitude, String depLatitude, String destLongitude, String destLatitude){
|
||||
|
||||
log.info("出发地经度:"+depLongitude);
|
||||
log.info("出发地纬度:"+depLatitude);
|
||||
log.info("目的地经度:"+destLongitude);
|
||||
log.info("目的地纬度:"+destLatitude);
|
||||
|
||||
DirectionResponse directionResponse = new DirectionResponse();
|
||||
directionResponse.setDistance(123);
|
||||
directionResponse.setDuration(11);
|
||||
|
||||
return ResponseResult.success(directionResponse);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue