飞滴出行网约车2022-预估价格service-map骨架代码编写

master
yh 3 years ago
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…
Cancel
Save