|
|
@@ -17,6 +17,7 @@ import com.ruoyi.system.mapper.PosFreightMapper;
|
|
|
import com.ruoyi.system.service.IPosFreightService;
|
|
|
import com.ruoyi.system.utils.AddPush;
|
|
|
import com.ruoyi.system.utils.GetArea;
|
|
|
+import com.ruoyi.system.utils.JedisFactory;
|
|
|
import com.ruoyi.web.controller.common.CommonController;
|
|
|
import io.swagger.models.auth.In;
|
|
|
import org.slf4j.Logger;
|
|
|
@@ -39,6 +40,8 @@ public class SysFileInfoController extends BaseController {
|
|
|
private IPosFreightService posFreightService;
|
|
|
@Autowired
|
|
|
private PosFreightMapper posFreightMapper;
|
|
|
+ @Autowired
|
|
|
+ private JedisFactory jedisFactory;
|
|
|
private static final Logger log = LoggerFactory.getLogger(SysFileInfoController.class);
|
|
|
|
|
|
//上传
|
|
|
@@ -59,9 +62,12 @@ public class SysFileInfoController extends BaseController {
|
|
|
public AjaxResult getLocationAddr(@RequestParam String latlng,
|
|
|
@RequestParam Integer type,
|
|
|
@RequestParam(defaultValue = "") String id) {
|
|
|
- Jedis jedis = new Jedis("localhost", 6379);
|
|
|
GetArea area = new GetArea();
|
|
|
- String lang = jedis.get(id) == null ? "zh-TW" : jedis.get(id);
|
|
|
+ String lang;
|
|
|
+ try (Jedis jedis = jedisFactory.create()) {
|
|
|
+ String savedLanguage = jedis.get(id);
|
|
|
+ lang = savedLanguage == null ? "zh-TW" : savedLanguage;
|
|
|
+ }
|
|
|
JSONObject reg;
|
|
|
//type=0 百度逆地理分支已停用(2026-09-29 标记),保留兜底不删;当前在用的是 type=1 谷歌分支
|
|
|
if (type == 0) {
|
|
|
@@ -77,8 +83,11 @@ public class SysFileInfoController extends BaseController {
|
|
|
@GetMapping("/getAddr")
|
|
|
public AjaxResult getAddr(@RequestParam String latlng,
|
|
|
@RequestParam(defaultValue = "") String id) {
|
|
|
- Jedis jedis = new Jedis("localhost", 6379);
|
|
|
- String lang = jedis.get(id) == null ? "zh-TW" : jedis.get(id);
|
|
|
+ String lang;
|
|
|
+ try (Jedis jedis = jedisFactory.create()) {
|
|
|
+ String savedLanguage = jedis.get(id);
|
|
|
+ lang = savedLanguage == null ? "zh-TW" : savedLanguage;
|
|
|
+ }
|
|
|
GetArea area = new GetArea();
|
|
|
JSONObject reg = area.getgoogleadd(latlng, lang);
|
|
|
return success(reg);
|
|
|
@@ -197,8 +206,7 @@ public class SysFileInfoController extends BaseController {
|
|
|
@RequestParam String latlng2,
|
|
|
@RequestParam(defaultValue = "") String id) {
|
|
|
log.info("谷歌地图:开始处理路径计算请求 -> ID: {}, 坐标1: {}, 坐标2: {}", id, latlng1, latlng2);
|
|
|
- try(Jedis jedis=new Jedis("localhost", 6379);) {
|
|
|
- //Jedis jedis = new Jedis("localhost", 6379);
|
|
|
+ try(Jedis jedis=jedisFactory.create()) {
|
|
|
String lang = jedis.get(id) == null ? "zh-TW" : jedis.get(id);
|
|
|
GetArea area = new GetArea();
|
|
|
JSONObject reg = area.getluxian(latlng1, latlng2, lang);
|
|
|
@@ -226,8 +234,7 @@ public class SysFileInfoController extends BaseController {
|
|
|
@RequestParam String lnglat2,
|
|
|
@RequestParam(defaultValue = "") String id) {
|
|
|
log.info("Mapbox地图:开始处理路径计算请求 -> ID: {}, 坐标1: {}, 坐标2: {}", id, lnglat1, lnglat2);
|
|
|
- try(Jedis jedis=new Jedis("localhost", 6379);) {
|
|
|
- //Jedis jedis = new Jedis("localhost", 6379);
|
|
|
+ try(Jedis jedis=jedisFactory.create()) {
|
|
|
String lang = jedis.get(id) == null ? "zh-TW" : jedis.get(id);
|
|
|
GetArea area = new GetArea();
|
|
|
JSONObject reg = area.getmpluxian(lnglat1, lnglat2);
|