Commit 04d7b5fb by 杨林龙

优化Gps基站消费逻辑

1 parent 3e6b7efb
...@@ -11,10 +11,11 @@ import com.glsx.plat.redis.utils.RedisUtils; ...@@ -11,10 +11,11 @@ import com.glsx.plat.redis.utils.RedisUtils;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.DataAccessException; import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.core.RedisOperations; import org.springframework.data.redis.core.RedisOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SessionCallback; import org.springframework.data.redis.core.SessionCallback;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date; import java.util.Date;
...@@ -35,7 +36,8 @@ public class TransitHandleService { ...@@ -35,7 +36,8 @@ public class TransitHandleService {
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired @Autowired
private StringRedisTemplate stringRedisTemplate; @Qualifier("restRedisTemplate")
private RedisTemplate<String, Object> redisTemplate;
@Autowired @Autowired
private RemoteDeviceLocationService remoteDeviceLocationService; private RemoteDeviceLocationService remoteDeviceLocationService;
...@@ -144,7 +146,7 @@ public class TransitHandleService { ...@@ -144,7 +146,7 @@ public class TransitHandleService {
// 通过sn从 redis中获取数据 并入库 // 通过sn从 redis中获取数据 并入库
List<DeviceLocationDto> deviceLocationList = Lists.newArrayList(); List<DeviceLocationDto> deviceLocationList = Lists.newArrayList();
stringRedisTemplate.executePipelined(new SessionCallback<Object>() { redisTemplate.executePipelined(new SessionCallback<Object>() {
@Override @Override
public Object execute(RedisOperations redisOperations) throws DataAccessException { public Object execute(RedisOperations redisOperations) throws DataAccessException {
snTempList.forEach(sn -> { snTempList.forEach(sn -> {
...@@ -171,7 +173,7 @@ public class TransitHandleService { ...@@ -171,7 +173,7 @@ public class TransitHandleService {
}); });
return null; return null;
} }
}, stringRedisTemplate.getValueSerializer()); }, redisTemplate.getValueSerializer());
// 数据入库 // 数据入库
remoteDeviceLocationService.saveOrUpdateDeviceLocationData(deviceLocationList); remoteDeviceLocationService.saveOrUpdateDeviceLocationData(deviceLocationList);
// 将sn解锁 // 将sn解锁
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!