add:实现service-map功能

master
msb_89821 2 years ago
parent 3eafe9f8e7
commit 58d9ab5518

@ -0,0 +1,45 @@
<?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">
<parent>
<artifactId>oneline-text-plublic</artifactId>
<groupId>com.mashibing</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>service-map</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.mashibing</groupId>
<artifactId>untitled4</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,24 @@
package com.mashibing.service.map;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* Copyright© 2020.10.20 by .All rights reserved.
* 1.
* 2.
* 3.使.
* <b>Description:</b><br>
*
* @author nod
* <b>ProjectName:</b> onelinetextplublic
* <br><b>PackageName:</b> com.mashibing.service.map
* <br><b>ClassName:</b>
* <br><b>Date:</b> 2022/10/22 16:32
*/
@SpringBootApplication
public class ServiceMapApplication {
public static void main(String[] args) {
SpringApplication.run(ServiceMapApplication.class,args);
}
}

@ -0,0 +1,40 @@
package com.mashibing.service.map.controller;
import com.alibaba.fastjson.JSON;
import com.mashibing.dto.AddressLatiLong;
import com.mashibing.dto.DistanceResult;
import com.mashibing.dto.ResponseResult;
import com.mashibing.service.map.service.DistanceService;
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;
import javax.annotation.Resource;
/**
* Copyright© 2020.10.20 by .All rights reserved.
* 1.
* 2.
* 3.使.
* <b>Description:</b><br>
*
* @author nod
* <b>ProjectName:</b> onelinetextplublic
* <br><b>PackageName:</b> com.mashibing.service.map.controller
* <br><b>ClassName:</b>
* <br><b>Date:</b> 2022/10/22 17:07
*/
@Slf4j
@RestController
public class DistanceController {
@Resource
private DistanceService distanceService;
@PostMapping("/queryDistanceResult")
public ResponseResult queryDistanceResult(@RequestBody AddressLatiLong addressLatiLong){
log.info("service-map 获取请求参数={}", JSON.toJSONString(addressLatiLong));
return ResponseResult.success(distanceService.queryDistanceResult(addressLatiLong));
}
}

@ -0,0 +1,35 @@
package com.mashibing.service.map.service;
import com.alibaba.fastjson.JSON;
import com.mashibing.dto.AddressLatiLong;
import com.mashibing.dto.DistanceResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* Copyright© 2020.10.20 by .All rights reserved.
* 1.
* 2.
* 3.使.
* <b>Description:</b><br>
*
* @author nod
* <b>ProjectName:</b> onelinetextplublic
* <br><b>PackageName:</b> com.mashibing.service.map.service
* <br><b>ClassName:</b>
* <br><b>Date:</b> 2022/10/22 17:30
*/
@Slf4j
@Service
public class DistanceService {
private static final String reqPath = "/v3/direction/driving";
public DistanceResult queryDistanceResult(AddressLatiLong addressLatiLong){
log.info("调高德服务商获取距离 参数={}", JSON.toJSONString(addressLatiLong));
DistanceResult distanceResult =new DistanceResult();
return distanceResult;
}
}

@ -0,0 +1,16 @@
server:
port: 8087
spring:
cloud:
nacos:
discovery:
server-addr: 127.0.0.1:8848
application:
name: service-map
gaodeMap:
key: 595148d3d09d60942adaaacf7dfb95aa
url: https://restapi.amap.com

@ -0,0 +1,28 @@
package com.mashibing.dto;
import lombok.Data;
/**
* Copyright© 2020.10.20 by .All rights reserved.
* 1.
* 2.
* 3.使.
* <b>Description:</b><br>
*
* @author nod
* <b>ProjectName:</b> onelinetextplublic
* <br><b>PackageName:</b> com.mashibing.dto
* <br><b>ClassName:</b>
* <br><b>Date:</b> 2022/10/22 11:16
*/
@Data
public class DistanceResult {
private Integer distance;
private Integer duration;
public DistanceResult(Integer distance, Integer duration) {
this.distance = distance;
this.duration = duration;
}
}
Loading…
Cancel
Save