Commit d6197e58 by 刘鑫

Merge branch 'develop' of https://gitlab.dituhui.com/bsh/project/project into develop

2 parents ba3bab87 79684c94
......@@ -13,6 +13,7 @@ import java.util.Map;
import cn.hutool.core.util.StrUtil;
import com.dituhui.pea.dispatch.common.redis.RedisUtil;
import com.dituhui.pea.enums.RedisKeyGroup;
import org.springframework.stereotype.Component;
import com.dituhui.pea.dispatch.pojo.Location;
......@@ -64,7 +65,7 @@ public class RoadDistanceUtils {
return dis;
} else {
//distanceCache.put(key, distance);
RedisUtil.set(key, distance);
RedisUtil.set(key, distance, 3600 * 24 * 7);
}
return distance;
} else {
......@@ -100,7 +101,7 @@ public class RoadDistanceUtils {
return dis;
} else {
//distanceCache.put(key, distance);
RedisUtil.set(key, distance);
RedisUtil.set(key, distance, 3600 * 24 * 7);
}
return distance;
} else {
......@@ -113,7 +114,7 @@ public class RoadDistanceUtils {
}
public static String getLocationKey(Location from, Location to, int vehicleType) {
return convertDoubleToStr(from.getLongitude()) + ","
return RedisKeyGroup.locationDistanceKey + ":" + convertDoubleToStr(from.getLongitude()) + ","
+ convertDoubleToStr(from.getLatitude()) + ";"
+ convertDoubleToStr(to.getLongitude()) + ","
+ convertDoubleToStr(to.getLatitude()) + "|" + vehicleType;
......
......@@ -18,6 +18,11 @@ public enum RedisKeyGroup {
/**
* 资源信息
*/
resourceKey;
resourceKey,
/**
* 坐标距离信息
*/
locationDistanceKey;
}
......@@ -6,6 +6,7 @@ import com.dituhui.pea.order.dto.param.CapacityQueryDTO;
import com.dituhui.pea.order.dto.param.OrderDTO;
import com.dituhui.pea.order.service.CapacityQueryService;
import com.dituhui.pea.order.service.OrderCreateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -22,6 +23,7 @@ import java.time.ZoneId;
*/
@RestController
@RequestMapping("/pea-order")
@Slf4j
public class OrderCreateController {
@Autowired
......@@ -36,6 +38,7 @@ public class OrderCreateController {
try {
res = orderCreateService.createOrder(orderCreateReqDTO);
} catch (BusinessException e) {
log.error("创建订单失败:" + e.getMessage(), e);
return Result.failed(e.getMessage());
}
return res;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!