预估价格service-price项目创建

main
topsun 2 years ago
parent 6c03ff40e8
commit fe6807bca9

@ -8,6 +8,7 @@
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="internal-common" />
<module name="servcie-price" />
<module name="api-passenger" />
<module name="service-passenger-user" />
<module name="service-verificationcode" />
@ -19,6 +20,7 @@
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="api-passenger" options="-parameters" />
<module name="internal-common" options="-parameters" />
<module name="servcie-price" options="-parameters" />
<module name="service-passenger-user" options="-parameters" />
<module name="service-verificationcode" options="-parameters" />
</option>

@ -4,6 +4,7 @@
<file url="file://$PROJECT_DIR$/api-passenger/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/api-passenger/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/internal-common/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/servcie-price/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/service-passenger-user/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/service-verificationcode/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />

@ -0,0 +1,34 @@
package com.taxi.apipassenger.controller;
import com.internal.dto.ResponseResult;
import com.internal.request.ForecastPriceDTO;
import com.taxi.apipassenger.service.ForecastPriceServcie;
import lombok.extern.slf4j.Slf4j;
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
@Slf4j
public class ForecastPriceController {
@Autowired
private ForecastPriceServcie forecastPriceServcie;
@PostMapping("/forecast-price")
public ResponseResult forecastPrice(@RequestBody ForecastPriceDTO forecastPriceDTO) {
log.info("出发经度," + forecastPriceDTO.getDepLongitude());
log.info("出发纬度," + forecastPriceDTO.getDepLatitude());
String depLongitude = forecastPriceDTO.getDepLongitude();
String depLatitude = forecastPriceDTO.getDestLatitude();
String destLongitude = forecastPriceDTO.getDestLongitude();
String destLatitude = forecastPriceDTO.getDestLatitude();
log.info("目的地经度," + forecastPriceDTO.getDestLongitude());
log.info("目的地纬度," + forecastPriceDTO.getDestLatitude());
return forecastPriceServcie.forecastPrice(depLongitude,depLatitude,destLongitude,destLatitude);
}
}

@ -0,0 +1,35 @@
package com.taxi.apipassenger.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 ForecastPriceServcie {
/**
*
* @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("调用计价服务,计算价格");
ForecastPriceResponse forecastPriceResponse = new ForecastPriceResponse();
forecastPriceResponse.setPrice(12.121);
return ResponseResult.success(forecastPriceResponse);
}
}

@ -0,0 +1,13 @@
package com.internal.request;
import lombok.Data;
@Data
public class ForecastPriceDTO {
private String depLongitude;
private String depLatitude;
private String destLongitude;
private String destLatitude;
}

@ -0,0 +1,9 @@
package com.internal.response;
import lombok.Data;
@Data
public class ForecastPriceResponse {
private double price;
}

@ -19,6 +19,7 @@
<module>service-verificationcode</module>
<module>internal-common</module>
<module>service-passenger-user</module>
<module>servcie-price</module>
</modules>
<properties>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.taxi</groupId>
<artifactId>online-taxi-public</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>servcie-price</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

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