测试环境redis 更换到0库
通用接口添加 根据经纬度获取位置信息接口
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package com.chaozhanggui.system.cashierservice.controller;
|
||||
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbPlatformDictMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPlatformDict;
|
||||
import com.chaozhanggui.system.cashierservice.entity.vo.DistrictVo;
|
||||
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||
import com.chaozhanggui.system.cashierservice.service.FileService;
|
||||
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
|
||||
@@ -83,16 +85,22 @@ public class CommonController {
|
||||
*/
|
||||
@GetMapping("location/district")
|
||||
public Result createOrder(String keywords) throws JsonProcessingException {
|
||||
String district = LocationUtils.district(keywords);
|
||||
String districtJson = LocationUtils.district(keywords);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
// 将 JSON 字符串解析为 JsonNode 对象
|
||||
JsonNode jsonNode = mapper.readTree(district);
|
||||
JsonNode jsonNode = mapper.readTree(districtJson);
|
||||
JsonNode districts = jsonNode.get("districts");
|
||||
|
||||
|
||||
return Result.success(CodeEnum.SUCCESS, districts);
|
||||
String text = districts.toString();
|
||||
List<DistrictVo> cityInfoList = mapper.readValue(text, mapper.getTypeFactory().constructCollectionType(List.class, DistrictVo.class));
|
||||
return Result.success(CodeEnum.SUCCESS, cityInfoList);
|
||||
}
|
||||
|
||||
@GetMapping("location/geocode")
|
||||
public Result geocode(String location){
|
||||
return Result.success(CodeEnum.SUCCESS, LocationUtils.geocode(location));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("location/getGPSByIp")
|
||||
public Result getGPSByIp(String ip) throws JsonProcessingException {
|
||||
String gpsInfo = LocationUtils.getGPSByIp(ip);
|
||||
|
||||
Reference in New Issue
Block a user