Commit 79684c94 by Ren Ping

fix:修改位置坐标redis key

1 parent 71a7c86f
...@@ -13,6 +13,7 @@ import java.util.Map; ...@@ -13,6 +13,7 @@ import java.util.Map;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.dituhui.pea.dispatch.common.redis.RedisUtil; import com.dituhui.pea.dispatch.common.redis.RedisUtil;
import com.dituhui.pea.enums.RedisKeyGroup;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.dituhui.pea.dispatch.pojo.Location; import com.dituhui.pea.dispatch.pojo.Location;
...@@ -64,7 +65,7 @@ public class RoadDistanceUtils { ...@@ -64,7 +65,7 @@ public class RoadDistanceUtils {
return dis; return dis;
} else { } else {
//distanceCache.put(key, distance); //distanceCache.put(key, distance);
RedisUtil.set(key, distance); RedisUtil.set(key, distance, 3600 * 24 * 7);
} }
return distance; return distance;
} else { } else {
...@@ -100,7 +101,7 @@ public class RoadDistanceUtils { ...@@ -100,7 +101,7 @@ public class RoadDistanceUtils {
return dis; return dis;
} else { } else {
//distanceCache.put(key, distance); //distanceCache.put(key, distance);
RedisUtil.set(key, distance); RedisUtil.set(key, distance, 3600 * 24 * 7);
} }
return distance; return distance;
} else { } else {
...@@ -113,7 +114,7 @@ public class RoadDistanceUtils { ...@@ -113,7 +114,7 @@ public class RoadDistanceUtils {
} }
public static String getLocationKey(Location from, Location to, int vehicleType) { public static String getLocationKey(Location from, Location to, int vehicleType) {
return convertDoubleToStr(from.getLongitude()) + "," return RedisKeyGroup.locationDistanceKey + ":" + convertDoubleToStr(from.getLongitude()) + ","
+ convertDoubleToStr(from.getLatitude()) + ";" + convertDoubleToStr(from.getLatitude()) + ";"
+ convertDoubleToStr(to.getLongitude()) + "," + convertDoubleToStr(to.getLongitude()) + ","
+ convertDoubleToStr(to.getLatitude()) + "|" + vehicleType; + convertDoubleToStr(to.getLatitude()) + "|" + vehicleType;
......
...@@ -18,6 +18,11 @@ public enum RedisKeyGroup { ...@@ -18,6 +18,11 @@ public enum RedisKeyGroup {
/** /**
* 资源信息 * 资源信息
*/ */
resourceKey; resourceKey,
/**
* 坐标距离信息
*/
locationDistanceKey;
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!