预估价格service-price骨架编写完成

main
topsun 2 years ago
parent fe6807bca9
commit c2ad6dc971

@ -1,7 +0,0 @@
package com.taxi;
public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

@ -0,0 +1,12 @@
package com.taxi.serviceprice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ServicePriceApplication {
public static void main(String[] args) {
SpringApplication.run(ServicePriceApplication.class);
}
}

@ -0,0 +1,28 @@
package com.taxi.serviceprice.controller;
import com.internal.dto.ResponseResult;
import com.internal.request.ForecastPriceDTO;
import com.taxi.serviceprice.service.ForecastPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class ForecastPriceController {
@Autowired
private ForecastPriceService forecastPriceService;
@PostMapping("/forecast-price")
public ResponseResult forecastPrice(@RequestBody ForecastPriceDTO forecastPriceDTO){
String depLongitude = forecastPriceDTO.getDepLongitude();
String depLatitude = forecastPriceDTO.getDestLatitude();
String destLongitude = forecastPriceDTO.getDestLongitude();
String destLatitude = forecastPriceDTO.getDestLatitude();
return forecastPriceService.forecastPrice(depLongitude,depLatitude,
destLongitude,destLatitude);
}
}

@ -0,0 +1,35 @@
package com.taxi.serviceprice.service;
import com.internal.dto.ResponseResult;
import com.internal.response.ForecastPriceResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class ForecastPriceService {
/**
*
* @param depLongitude
* @param depLatitude
* @param destLongitude
* @param destLatitude
* @return
*/
public ResponseResult forecastPrice(String depLongitude, String depLatitude,
String destLongitude, String destLatitude){
log.info("出发经度," + depLongitude);
log.info("出发纬度," + depLatitude);
log.info("目的地经度," + destLongitude);
log.info("目的地纬度," + destLatitude);
log.info("调用地图服务,查询地图和时长");
log.info("读取计价规则");
log.info("根据距离、时长,计价规则;计算价格");
ForecastPriceResponse forecastPriceResponse = new ForecastPriceResponse();
forecastPriceResponse.setPrice(12.121);
return ResponseResult.success(forecastPriceResponse);
}
}
Loading…
Cancel
Save