修改获取redis的方法,默认从2号库获取序列

This commit is contained in:
RenKaiGe-Office
2018-05-24 16:36:26 +08:00
parent 5c3b340a97
commit 2391170301
3 changed files with 11 additions and 11 deletions

View File

@@ -64,7 +64,7 @@ public class ConfigSourcesController extends BaseRestController {
if (type == 1) { if (type == 1) {
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
Integer service = 98; Integer service = 98;
long id = configRedisService.getIncrId("seq_compileid", service); long id = configRedisService.getIncrId("seq_compileid");
// int id=2; // int id=2;
map.put("cfg_id", id + ""); map.put("cfg_id", id + "");
map.put("is_valid", "1"); map.put("is_valid", "1");
@@ -80,7 +80,7 @@ public class ConfigSourcesController extends BaseRestController {
Integer service = 100; Integer service = 100;
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
long id = configRedisService.getIncrId("seq_compileid", service); long id = configRedisService.getIncrId("seq_compileid");
// int id=2; // int id=2;
map.put("cfg_id", id + ""); map.put("cfg_id", id + "");
map.put("is_valid", "1"); map.put("is_valid", "1");
@@ -118,9 +118,9 @@ public class ConfigSourcesController extends BaseRestController {
public MaatConfig getMaatConfig(Integer service) { public MaatConfig getMaatConfig(Integer service) {
String time = new Date().getTime() + ""; String time = new Date().getTime() + "";
Map<String, String> configMap = new HashMap<String, String>(); Map<String, String> configMap = new HashMap<String, String>();
long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID", service); long seq_compileid = configRedisService.getIncrId("SEQ_COMPILEID");
long seq_groupid = configRedisService.getIncrId("SEQ_GROUPID", service); long seq_groupid = configRedisService.getIncrId("SEQ_GROUPID");
long seq_regionid = configRedisService.getIncrId("SEQ_REGIONID", service); long seq_regionid = configRedisService.getIncrId("SEQ_REGIONID");
// int id=2; // int id=2;
configMap.put("cfg_id", seq_compileid + ""); configMap.put("cfg_id", seq_compileid + "");
configMap.put("service", service + ""); configMap.put("service", service + "");

View File

@@ -34,5 +34,5 @@ public interface ConfigRedisService {
* @param key 需要自增的key * @param key 需要自增的key
* @return * @return
*/ */
public Long getIncrId(String key, int service); public Long getIncrId(String key);
} }

View File

@@ -289,8 +289,8 @@ public class ConfigRedisServiceimpl extends BaseRedisDao<String, String> impleme
} }
} }
public Long getIncrId(String key, int service) { public Long getIncrId(String key) {
DynamicJedisDataBase.setRedisDataBase(getRedisDBByService(service), redisTemplate); //DynamicJedisDataBase.setRedisDataBase(getRedisDBByService(service), redisTemplate);
// RedisAtomicLong atomicLong = new RedisAtomicLong(key, // RedisAtomicLong atomicLong = new RedisAtomicLong(key,
// redisTemplate.getConnectionFactory()); // redisTemplate.getConnectionFactory());
// //