diff --git a/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/ForecastPriceController.java b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/ForecastPriceController.java new file mode 100644 index 0000000..74276e4 --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/controller/ForecastPriceController.java @@ -0,0 +1,38 @@ +package mashibing.online.text.controller; + +import com.alibaba.fastjson.JSON; +import com.mashibing.dto.AddressLatiLong; +import com.mashibing.dto.PriceResult; +import com.mashibing.dto.ResponseResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: mashibing.online.text.controller + *
ClassName: + *
Date: 2022/10/22 11:17 + */ +@Slf4j +@RestController +public class ForecastPriceController { + + + @PostMapping("/getForecastPrice") + public ResponseResult getForecastPrice(@RequestBody AddressLatiLong addressLatiLong){ + log.info("api-passinger 服务 请求参数={}", JSON.toJSONString(addressLatiLong)); + + PriceResult priceResult =new PriceResult("34.12"); + return ResponseResult.success(priceResult); + } +} diff --git a/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/feign/ForecastPriceService.java b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/feign/ForecastPriceService.java new file mode 100644 index 0000000..51aa14b --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/feign/ForecastPriceService.java @@ -0,0 +1,29 @@ +package mashibing.online.text.feign; + +import com.mashibing.dto.AddressLatiLong; +import com.mashibing.dto.ResponseResult; +import mashibing.online.text.feign.fallback.ForecastPriceServiceImpl; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: mashibing.online.text.feign.fallback + *
ClassName: + *
Date: 2022/10/22 14:02 + */ +@FeignClient(name = "service-price",fallback = ForecastPriceServiceImpl.class) +public interface ForecastPriceService { + + @RequestMapping(value = "/getForecastPrice", method = RequestMethod.POST) + public ResponseResult getForecastPrice(@RequestBody AddressLatiLong addressLatiLong) ; +} diff --git a/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/feign/fallback/ForecastPriceServiceImpl.java b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/feign/fallback/ForecastPriceServiceImpl.java new file mode 100644 index 0000000..bc53aa1 --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/api-passinger/src/main/java/mashibing/online/text/feign/fallback/ForecastPriceServiceImpl.java @@ -0,0 +1,29 @@ +package mashibing.online.text.feign.fallback; + +import com.mashibing.dto.AddressLatiLong; +import com.mashibing.dto.ResponseResult; +import lombok.extern.slf4j.Slf4j; +import mashibing.online.text.feign.ForecastPriceService; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: mashibing.online.text.feign.fallback + *
ClassName: + *
Date: 2022/10/22 14:13 + */ +@Slf4j +public class ForecastPriceServiceImpl implements ForecastPriceService { + + @Override + public ResponseResult getForecastPrice(AddressLatiLong addressLatiLong) { + log.info("调用 service - price 失败"); + return ResponseResult.fail(); + } +} diff --git a/oneLineTxt/v1/onelinetextplublic/pom.xml b/oneLineTxt/v1/onelinetextplublic/pom.xml index ad7744f..6ef9645 100644 --- a/oneLineTxt/v1/onelinetextplublic/pom.xml +++ b/oneLineTxt/v1/onelinetextplublic/pom.xml @@ -70,6 +70,7 @@ send-server untitled4 service-passenger-user + service-price diff --git a/oneLineTxt/v1/onelinetextplublic/service-price/pom.xml b/oneLineTxt/v1/onelinetextplublic/service-price/pom.xml new file mode 100644 index 0000000..20724e5 --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/service-price/pom.xml @@ -0,0 +1,45 @@ + + + + + oneline-text-plublic + com.mashibing + 1.0-SNAPSHOT + + + 4.0.0 + + service-price + + + + org.springframework.boot + spring-boot-starter-web + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + com.mashibing + untitled4 + 1.0-SNAPSHOT + compile + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/oneLineTxt/v1/onelinetextplublic/service-price/src/main/java/com/mashibing/service/price/ServicePriceApplication.java b/oneLineTxt/v1/onelinetextplublic/service-price/src/main/java/com/mashibing/service/price/ServicePriceApplication.java new file mode 100644 index 0000000..35a0e44 --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/service-price/src/main/java/com/mashibing/service/price/ServicePriceApplication.java @@ -0,0 +1,25 @@ +package com.mashibing.service.price; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: com.mashibing.service.price + *
ClassName: + *
Date: 2022/10/22 11:30 + */ +@SpringBootApplication +public class ServicePriceApplication { + + public static void main(String[] args) { + SpringApplication.run(ServicePriceApplication.class, args); + } +} diff --git a/oneLineTxt/v1/onelinetextplublic/service-price/src/main/java/com/mashibing/service/price/controller/ForecastPriceController.java b/oneLineTxt/v1/onelinetextplublic/service-price/src/main/java/com/mashibing/service/price/controller/ForecastPriceController.java new file mode 100644 index 0000000..1f06d24 --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/service-price/src/main/java/com/mashibing/service/price/controller/ForecastPriceController.java @@ -0,0 +1,37 @@ +package com.mashibing.service.price.controller; + +import com.alibaba.fastjson.JSON; +import com.mashibing.dto.AddressLatiLong; +import com.mashibing.dto.PriceResult; +import com.mashibing.dto.ResponseResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: mashibing.online.text.controller + *
ClassName: + *
Date: 2022/10/22 11:17 + */ +@Slf4j +@RestController +public class ForecastPriceController { + + + @PostMapping("/getForecastPrice") + public ResponseResult getForecastPrice(@RequestBody AddressLatiLong addressLatiLong){ + log.info("api-passinger 服务 请求参数={}", JSON.toJSONString(addressLatiLong)); + + PriceResult priceResult =new PriceResult("34.12"); + return ResponseResult.success(priceResult); + } +} diff --git a/oneLineTxt/v1/onelinetextplublic/service-price/src/main/resources/application.yml b/oneLineTxt/v1/onelinetextplublic/service-price/src/main/resources/application.yml new file mode 100644 index 0000000..255bbbb --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/service-price/src/main/resources/application.yml @@ -0,0 +1,11 @@ +server: + port: 8086 + + +spring: + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 + application: + name: service-price diff --git a/oneLineTxt/v1/onelinetextplublic/untitled4/src/main/java/com/mashibing/dto/AddressLatiLong.java b/oneLineTxt/v1/onelinetextplublic/untitled4/src/main/java/com/mashibing/dto/AddressLatiLong.java new file mode 100644 index 0000000..8f8f6fb --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/untitled4/src/main/java/com/mashibing/dto/AddressLatiLong.java @@ -0,0 +1,24 @@ +package com.mashibing.dto; + +import lombok.Data; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: com.mashibing.dto + *
ClassName: + *
Date: 2022/10/22 10:58 + */ +@Data +public class AddressLatiLong { + private String originLong; + private String originLati; + private String destinationLong; + private String destinationLati; +} diff --git a/oneLineTxt/v1/onelinetextplublic/untitled4/src/main/java/com/mashibing/dto/PriceResult.java b/oneLineTxt/v1/onelinetextplublic/untitled4/src/main/java/com/mashibing/dto/PriceResult.java new file mode 100644 index 0000000..d37ed8e --- /dev/null +++ b/oneLineTxt/v1/onelinetextplublic/untitled4/src/main/java/com/mashibing/dto/PriceResult.java @@ -0,0 +1,26 @@ +package com.mashibing.dto; + +import lombok.Data; + +/** + * Copyright© 2020.10.20 by 博纳德集团有限公司.All rights reserved. + * 1.版权归博纳德集团公司所有; + * 2.未经原作者允许不得转载本代码内容,否则将视为侵权; + * 3.对于不遵守此声明或者其他违法使用本代码内容者,本公司依法保留追究权。. + * Description:
+ * + * @author nod + * ProjectName: onelinetextplublic + *
PackageName: com.mashibing.dto + *
ClassName: + *
Date: 2022/10/22 11:16 + */ +@Data +public class PriceResult { + + private String forecastPrice; + + public PriceResult(String forecastPrice) { + this.forecastPrice = forecastPrice; + } +}