Commit 04d7b5fb by 杨林龙

优化Gps基站消费逻辑

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