| | |
| | | import java.time.LocalTime; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import com.xiaopeng.common.core.constant.CacheConstants; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.*; |
| | | import org.springframework.data.redis.core.script.DefaultRedisScript; |
| | |
| | | Set<String> keys = redisTemplate.keys(name + "*"); |
| | | return keys; |
| | | } |
| | | |
| | | public void setCacheCancelOrder(String key) { |
| | | // 获取缓存中的值 |
| | | Object value = redisTemplate.opsForValue().get(key); |
| | | if (value != null) { |
| | | // 缓存中的值减1 |
| | | int newValue = Integer.parseInt(value.toString()) - 1; |
| | | // 更新缓存中的值 |
| | | redisTemplate.opsForValue().set(key, newValue); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 添加 KEY |
| | | * @param xpPointId 点位id |
| | | * @param pointLon 经度 |
| | | * @param pointLat 纬度 |
| | | * @return |
| | | */ |
| | | public String redisKey_QUEUE_POINT_ID(Long xpPointId,Double pointLon,Double pointLat){ |
| | | String key = CacheConstants.QUEUE_POINT_ID + "-" + xpPointId + "-" + pointLon + "," + pointLat; |
| | | return key; |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param orderId 订单id |
| | | * @param pointLon 经度 |
| | | * @param pointLat 纬度 |
| | | * @param uid 用户id |
| | | * @param orderNumber 订单编码 |
| | | * @param distance 距离 米 |
| | | * @param duration 时间 |
| | | * @param planRuleForQueue 选中路线对应的高德 |
| | | * @param targetedVal 是否定向 0 不定向 ,1-100 定向 |
| | | * @return |
| | | */ |
| | | public String redisValue_QUEUE_POINT_ID(String orderId,String pointLon,String pointLat,String uid,String orderNumber ,String distance,String duration,String planRuleForQueue,Integer targetedVal){ |
| | | return orderId + "_" + pointLon + "," + pointLat + "_0" + "_" + uid + "_" + orderNumber + "_" + distance + "_" + duration + "_" + planRuleForQueue+"_" + targetedVal; |
| | | } |
| | | |
| | | |
| | | } |