parent
a7beacfe6b
commit
b6d94b75c0
@ -0,0 +1,13 @@
|
||||
package com.mashibing.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.mashibing.serviceprice.controller;
|
||||
|
||||
import com.mashibing.internalcommon.dto.ResponseResult;
|
||||
import com.mashibing.internalcommon.request.ForecastPriceDTO;
|
||||
import com.mashibing.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 priceService;
|
||||
|
||||
@PostMapping("/forecast-price")
|
||||
public ResponseResult forecastPrice(@RequestBody ForecastPriceDTO forecastPriceDTO){
|
||||
|
||||
String depLongitude = forecastPriceDTO. getDepLongitude();
|
||||
String depLatitude = forecastPriceDTO.getDepLatitude();
|
||||
String destLongitude = forecastPriceDTO.getDestLongitude();
|
||||
String destLatitude = forecastPriceDTO.getDestLatitude();
|
||||
|
||||
return priceService.forecastPrice(depLongitude,depLatitude,destLongitude,destLatitude);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.mashibing.serviceprice.service;
|
||||
|
||||
import com.mashibing.internalcommon.dto.ResponseResult;
|
||||
import com.mashibing.internalcommon.response.ForecastPriceResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
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);
|
||||
|
||||
// 调用 地图服务,查询距离时长
|
||||
|
||||
// 读取计价规则
|
||||
|
||||
// 根据 距离时长 进行价格预估
|
||||
|
||||
|
||||
ForecastPriceResponse priceResponse = new ForecastPriceResponse();
|
||||
priceResponse.setPrice(12.34);
|
||||
|
||||
return ResponseResult.success(priceResponse);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
server:
|
||||
port: 8084
|
||||
spring:
|
||||
application:
|
||||
name: service-price
|
Loading…
Reference in new issue