记得上下班打卡 | git大法好,push需谨慎

Commit d9f080de authored by 胡佳晨's avatar 胡佳晨

redis 批量删除 修改 获取场地相关方法

parent 15a05d19
...@@ -53,12 +53,12 @@ public class MongoVoUtils { ...@@ -53,12 +53,12 @@ public class MongoVoUtils {
KylinPerformanceRelations p3 = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId)); KylinPerformanceRelations p3 = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId));
//场地相关数据 //场地相关数据
KylinFields fields = new KylinFields(); KylinFields fields = new KylinFields();
String cityName = (String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name"); String cityName = (String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name");
fields.setCityId(null); fields.setCityId(null);
fields.setLatitude((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "latitude")); fields.setLatitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "latitude"));
fields.setLongitude((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "longitude")); fields.setLongitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "longitude"));
fields.setCityName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name")); fields.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name"));
fields.setName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "name")); fields.setName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "name"));
//相关状态时间初始变量 //相关状态时间初始变量
LocalDateTime stopSellTime = null; LocalDateTime stopSellTime = null;
......
...@@ -33,7 +33,6 @@ import org.springframework.stereotype.Component; ...@@ -33,7 +33,6 @@ import org.springframework.stereotype.Component;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
...@@ -250,8 +249,8 @@ public class PerformanceVoUtils { ...@@ -250,8 +249,8 @@ public class PerformanceVoUtils {
KylinPerformanceRelations performanceRelations = new KylinPerformanceRelations(); KylinPerformanceRelations performanceRelations = new KylinPerformanceRelations();
BeanUtils.copyProperties(performanceUpdateMisVo, performanceRelations); BeanUtils.copyProperties(performanceUpdateMisVo, performanceRelations);
performances.setCityName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_name")); performances.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_name"));
performances.setCityId(Integer.parseInt((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_id"))); performances.setCityId(Integer.parseInt((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_id")));
performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getCreatedAt()))); performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getCreatedAt())));
performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getTimeStart()))); performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getTimeStart())));
performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getTimeEnd()))); performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(performanceUpdateMisVo.getTimeEnd())));
......
...@@ -6,9 +6,7 @@ import org.springframework.data.redis.core.RedisTemplate; ...@@ -6,9 +6,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
/** /**
...@@ -22,45 +20,38 @@ import java.util.concurrent.TimeUnit; ...@@ -22,45 +20,38 @@ import java.util.concurrent.TimeUnit;
*/ */
@Component("redisUtil") @Component("redisUtil")
public final class RedisUtil { public final class RedisUtil {
@Autowired @Autowired
private RedisConfig redisConfig; private RedisConfig redisConfig;
// =============================common============================ // =============================common============================
/** /**
* 指定缓存失效时间 * 指定缓存失效时间
*
* @param key 键 * @param key 键
* @param time 时间(秒) * @param time 时间(秒)
* @return * @return
*/ */
public boolean expire(String key, long time) { public boolean expire(String key, long time) {
if (time > 0) { if (time > 0) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).expire(key, time, TimeUnit.SECONDS); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).expire(key, time, TimeUnit.SECONDS);
} }
return true; return true;
} }
/** /**
* 根据key 获取过期时间 * 根据key 获取过期时间
*
* @param key 键 不能为null * @param key 键 不能为null
* @return 时间(秒) 返回0代表为永久有效 * @return 时间(秒) 返回0代表为永久有效
*/ */
public long getExpire(String key) { public long getExpire(String key) {
...@@ -71,18 +62,15 @@ public final class RedisUtil { ...@@ -71,18 +62,15 @@ public final class RedisUtil {
/** /**
* 判断key是否存在 * 判断key是否存在
*
* @param key 键 * @param key 键
* @return true 存在 false不存在 * @return true 存在 false不存在
*/ */
public boolean hasKey(String key) { public boolean hasKey(String key) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).hasKey(key); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).hasKey(key);
} }
...@@ -93,7 +81,7 @@ public final class RedisUtil { ...@@ -93,7 +81,7 @@ public final class RedisUtil {
*/ */
public void delKeysByPrefix(String prefix) { public void delKeysByPrefix(String prefix) {
if (null != prefix && prefix.trim().length() > 0) { if (null != prefix && prefix.trim().length() > 0) {
for(Integer key: RedisConfig.redisTemplateMap.keySet()){ for (Integer key : RedisConfig.redisTemplateMap.keySet()) {
Set<String> keys = redisConfig.getRedisTemplateByDb(key).keys(prefix.concat("*")); Set<String> keys = redisConfig.getRedisTemplateByDb(key).keys(prefix.concat("*"));
if (!CollectionUtils.isEmpty(keys)) { if (!CollectionUtils.isEmpty(keys)) {
...@@ -105,11 +93,9 @@ public final class RedisUtil { ...@@ -105,11 +93,9 @@ public final class RedisUtil {
/** /**
* 删除缓存(多db情况需要单独实现批量删除-该方法慎重使用) * 删除缓存(多db情况需要单独实现批量删除-该方法慎重使用)
*
* @param key 可以传一个值 或多个 * @param key 可以传一个值 或多个
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
...@@ -125,7 +111,7 @@ public final class RedisUtil { ...@@ -125,7 +111,7 @@ public final class RedisUtil {
} else { } else {
// redisTemplate.delete(CollectionUtils.arrayToList(key)); // redisTemplate.delete(CollectionUtils.arrayToList(key));
for(String keyStr:key){ for (String keyStr : key) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(keyStr)).delete(keyStr); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(keyStr)).delete(keyStr);
} }
} }
...@@ -134,27 +120,49 @@ public final class RedisUtil { ...@@ -134,27 +120,49 @@ public final class RedisUtil {
} }
public void delList(List<String> key) { private static final ArrayList<String> STRING_ARRAY_LIST = new ArrayList<>();
private static final HashMap<Integer, ArrayList<String>> INTEGER_ARRAY_LIST_HASH_MAP = new HashMap();
public static ArrayList<String> arrayListString() {
return (ArrayList<String>) STRING_ARRAY_LIST.clone();
}
public static HashMap<Integer, ArrayList<String>> hashMapIntegerArrayList() {
return (HashMap<Integer, ArrayList<String>>) INTEGER_ARRAY_LIST_HASH_MAP.clone();
}
public void delList(List<String> key) {
HashMap<Integer, ArrayList<String>> hashMap;
if (key != null && key.size() > 0) { if (key != null && key.size() > 0) {
for(String keyStr:key){ hashMap = hashMapIntegerArrayList();
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(keyStr)).delete(keyStr); //构建 需要删除的Redis HashMapDBKey
for (String keyStr : key) {
Integer dbPosition = MathUtil.getIndex(keyStr);
ArrayList<String> dbArray;
if (hashMap.containsKey(dbPosition)) {
dbArray = hashMap.get(dbPosition);
} else {
dbArray = arrayListString();
}
dbArray.add(keyStr);
hashMap.put(dbPosition, dbArray);
} }
// redisTemplate.delete(key);
}
//删除Redis
for (Integer redisDb: hashMap.keySet()) {
ArrayList<String> delRedisKeyList = hashMap.get(redisDb);
redisConfig.getRedisTemplateByDb(redisDb).delete(delRedisKeyList);
}
}
} }
// ============================String============================= // ============================String=============================
/** /**
* 普通缓存获取 * 普通缓存获取
*
* @param key 键 * @param key 键
* @return 值 * @return 值
*/ */
public Object get(String key) { public Object get(String key) {
...@@ -165,72 +173,58 @@ public final class RedisUtil { ...@@ -165,72 +173,58 @@ public final class RedisUtil {
/** /**
* 普通缓存放入 * 普通缓存放入
*
* @param key 键 * @param key 键
* @param value 值 * @param value 值
* @return true成功 false失败 * @return true成功 false失败
*/ */
public boolean set(String key, Object value) { public boolean set(String key, Object value) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForValue().set(key, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForValue().set(key, value);
return true;
return true;
} }
/** /**
* 普通缓存放入并设置时间 * 普通缓存放入并设置时间
*
* @param key 键 * @param key 键
* @param value 值 * @param value 值
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
* @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
* @return true成功 false 失败 * @return true成功 false 失败
*/ */
public boolean set(String key, Object value, long time) { public boolean set(String key, Object value, long time) {
if (time > 0) { if (time > 0) {
RedisTemplate<String, Object> redisTemplate = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)); RedisTemplate<String, Object> redisTemplate = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key));
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS); redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
} else { } else {
set(key, value); set(key, value);
} }
return true; return true;
} }
/** /**
* 递增 * 递增
*
* @param key 键 * @param key 键
* @param delta 要增加几(大于0) * @param delta 要增加几(大于0)
* @return * @return
*/ */
public long incr(String key, long delta) { public long incr(String key, long delta) {
...@@ -247,15 +241,11 @@ public final class RedisUtil { ...@@ -247,15 +241,11 @@ public final class RedisUtil {
/** /**
* 递减 * 递减
*
* @param key 键 * @param key 键
* @param delta 要减少几(小于0) * @param delta 要减少几(小于0)
* @return * @return
*/ */
public long decr(String key, long delta) { public long decr(String key, long delta) {
...@@ -274,15 +264,11 @@ public final class RedisUtil { ...@@ -274,15 +264,11 @@ public final class RedisUtil {
// ================================Map================================= // ================================Map=================================
/** /**
* HashGet * HashGet
*
* @param key 键 不能为null * @param key 键 不能为null
* @param item 项 不能为null * @param item 项 不能为null
* @return 值 * @return 值
*/ */
public Object hget(String key, String item) { public Object hget(String key, String item) {
...@@ -295,13 +281,10 @@ public final class RedisUtil { ...@@ -295,13 +281,10 @@ public final class RedisUtil {
/** /**
* 获取hashKey对应的所有键值 * 获取hashKey对应的所有键值
*
* @param key 键 * @param key 键
* @return 对应的多个键值 * @return 对应的多个键值
*/ */
public Map<Object, Object> hmget(String key) { public Map<Object, Object> hmget(String key) {
...@@ -312,125 +295,102 @@ public final class RedisUtil { ...@@ -312,125 +295,102 @@ public final class RedisUtil {
/** /**
* HashSet * HashSet
*
* @param key 键 * @param key 键
* @param map 对应多个键值 * @param map 对应多个键值
* @return true 成功 false 失败 * @return true 成功 false 失败
*/ */
public boolean hmset(String key, Map<String, Object> map) { public boolean hmset(String key, Map<String, Object> map) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().putAll(key, map); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().putAll(key, map);
return true; return true;
} }
/** /**
* HashSet 并设置时间 * HashSet 并设置时间
*
* @param key 键 * @param key 键
* @param map 对应多个键值
* @param map 对应多个键值
* @param time 时间(秒) * @param time 时间(秒)
* @return true成功 false失败 * @return true成功 false失败
*/ */
public boolean hmset(String key, Map<String, Object> map, long time) { public boolean hmset(String key, Map<String, Object> map, long time) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().putAll(key, map); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().putAll(key, map);
if (time > 0) { if (time > 0) {
expire(key, time); expire(key, time);
} }
return true; return true;
} }
/** /**
* 向一张hash表中放入数据,如果不存在将创建 * 向一张hash表中放入数据,如果不存在将创建
*
* @param key 键 * @param key 键
* @param item 项
* @param item 项
* @param value 值 * @param value 值
* @return true 成功 false失败 * @return true 成功 false失败
*/ */
public boolean hset(String key, String item, Object value) { public boolean hset(String key, String item, Object value) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().put(key, item, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().put(key, item, value);
return true; return true;
} }
/** /**
* 向一张hash表中放入数据,如果不存在将创建 * 向一张hash表中放入数据,如果不存在将创建
*
* @param key 键 * @param key 键
* @param item 项
* @param item 项
* @param value 值 * @param value 值
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
* @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
* @return true 成功 false失败 * @return true 成功 false失败
*/ */
public boolean hset(String key, String item, Object value, long time) { public boolean hset(String key, String item, Object value, long time) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().put(key, item, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForHash().put(key, item, value);
if (time > 0) { if (time > 0) {
expire(key, time); expire(key, time);
} }
return true; return true;
} }
/** /**
* 删除hash表中的值 * 删除hash表中的值
*
* @param key 键 不能为null * @param key 键 不能为null
* @param item 项 可以使多个 不能为null * @param item 项 可以使多个 不能为null
*/ */
public void hdel(String key, Object... item) { public void hdel(String key, Object... item) {
...@@ -441,15 +401,11 @@ public final class RedisUtil { ...@@ -441,15 +401,11 @@ public final class RedisUtil {
/** /**
* 判断hash表中是否有该项的值 * 判断hash表中是否有该项的值
*
* @param key 键 不能为null * @param key 键 不能为null
* @param item 项 不能为null * @param item 项 不能为null
* @return true 存在 false不存在 * @return true 存在 false不存在
*/ */
public boolean hHasKey(String key, String item) { public boolean hHasKey(String key, String item) {
...@@ -460,17 +416,12 @@ public final class RedisUtil { ...@@ -460,17 +416,12 @@ public final class RedisUtil {
/** /**
* hash递增 如果不存在,就会创建一个 并把新增后的值返回 * hash递增 如果不存在,就会创建一个 并把新增后的值返回
*
* @param key 键 * @param key 键
* @param item 项 * @param item 项
* @param by 要增加几(大于0)
* @param by 要增加几(大于0)
* @return * @return
*/ */
public double hincr(String key, String item, double by) { public double hincr(String key, String item, double by) {
...@@ -481,17 +432,12 @@ public final class RedisUtil { ...@@ -481,17 +432,12 @@ public final class RedisUtil {
/** /**
* hash递减 * hash递减
*
* @param key 键 * @param key 键
* @param item 项 * @param item 项
* @param by 要减少记(小于0)
* @param by 要减少记(小于0)
* @return * @return
*/ */
public double hdecr(String key, String item, double by) { public double hdecr(String key, String item, double by) {
...@@ -504,132 +450,109 @@ public final class RedisUtil { ...@@ -504,132 +450,109 @@ public final class RedisUtil {
// ============================set============================= // ============================set=============================
/** /**
* 根据key获取Set中的所有值 * 根据key获取Set中的所有值
*
* @param key 键 * @param key 键
* @return * @return
*/ */
public Set<Object> sGet(String key) { public Set<Object> sGet(String key) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().members(key); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().members(key);
} }
/** /**
* 根据value从一个set中查询,是否存在 * 根据value从一个set中查询,是否存在
*
* @param key 键 * @param key 键
* @param value 值 * @param value 值
* @return true 存在 false不存在 * @return true 存在 false不存在
*/ */
public boolean sHasKey(String key, Object value) { public boolean sHasKey(String key, Object value) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().isMember(key, value); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().isMember(key, value);
} }
/** /**
* 将数据放入set缓存 * 将数据放入set缓存
*
* @param key 键 * @param key 键
* @param values 值 可以是多个 * @param values 值 可以是多个
* @return 成功个数 * @return 成功个数
*/ */
public long sSet(String key, Object... values) { public long sSet(String key, Object... values) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().add(key, values); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().add(key, values);
} }
/** /**
* 将set数据放入缓存 * 将set数据放入缓存
*
* @param key 键 * @param key 键
* @param time 时间(秒)
* @param time 时间(秒)
* @param values 值 可以是多个 * @param values 值 可以是多个
* @return 成功个数 * @return 成功个数
*/ */
public long sSetAndTime(String key, long time, Object... values) { public long sSetAndTime(String key, long time, Object... values) {
Long count = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().add(key, values); Long count = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().add(key, values);
if (time > 0) if (time > 0)
expire(key, time); expire(key, time);
return count; return count;
} }
/** /**
* 获取set缓存的长度 * 获取set缓存的长度
*
* @param key 键 * @param key 键
* @return * @return
*/ */
public long sGetSetSize(String key) { public long sGetSetSize(String key) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().size(key); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().size(key);
} }
/** /**
* 移除值为value的 * 移除值为value的
*
* @param key 键 * @param key 键
* @param values 值 可以是多个 * @param values 值 可以是多个
* @return 移除的个数 * @return 移除的个数
*/ */
public long setRemove(String key, Object... values) { public long setRemove(String key, Object... values) {
Long count = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().remove(key, values); Long count = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForSet().remove(key, values);
return count; return count;
} }
...@@ -638,63 +561,51 @@ public final class RedisUtil { ...@@ -638,63 +561,51 @@ public final class RedisUtil {
/** /**
* 获取list缓存的内容 * 获取list缓存的内容
*
* @param key 键 * @param key 键
* @param start 开始 * @param start 开始
* @param end 结束 0 到 -1代表所有值
* @param end 结束 0 到 -1代表所有值
* @return * @return
*/ */
public List<Object> lGet(String key, long start, long end) { public List<Object> lGet(String key, long start, long end) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().range(key, start, end); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().range(key, start, end);
} }
/** /**
* 获取list缓存的长度 * 获取list缓存的长度
*
* @param key 键 * @param key 键
* @return * @return
*/ */
public long lGetListSize(String key) { public long lGetListSize(String key) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().size(key); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().size(key);
} }
/** /**
* 通过索引 获取list中的值 * 通过索引 获取list中的值
*
* @param key 键 * @param key 键
* @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
* @return * @return
*/ */
public Object lGetIndex(String key, long index) { public Object lGetIndex(String key, long index) {
return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().index(key, index); return redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().index(key, index);
} }
...@@ -702,6 +613,7 @@ public final class RedisUtil { ...@@ -702,6 +613,7 @@ public final class RedisUtil {
/** /**
* 将list放入缓存 * 将list放入缓存
*
* @param key * @param key
* @param value * @param value
* @return * @return
...@@ -709,38 +621,33 @@ public final class RedisUtil { ...@@ -709,38 +621,33 @@ public final class RedisUtil {
public boolean lSet(String key, Object value) { public boolean lSet(String key, Object value) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPush(key, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPush(key, value);
return true; return true;
} }
/** /**
* 将list放入缓存 * 将list放入缓存
*
* @param key 键 * @param key 键
* @param value 值 * @param value 值
* @param time 时间(秒)
* @param time 时间(秒)
* @return * @return
*/ */
public boolean lSet(String key, Object value, long time) { public boolean lSet(String key, Object value, long time) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPush(key, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPush(key, value);
if (time > 0) if (time > 0)
expire(key, time); expire(key, time);
return true; return true;
} }
...@@ -748,6 +655,7 @@ public final class RedisUtil { ...@@ -748,6 +655,7 @@ public final class RedisUtil {
/** /**
* 将list放入缓存 * 将list放入缓存
*
* @param key * @param key
* @param value * @param value
* @return * @return
...@@ -755,96 +663,87 @@ public final class RedisUtil { ...@@ -755,96 +663,87 @@ public final class RedisUtil {
public boolean lSet(String key, List<Object> value) { public boolean lSet(String key, List<Object> value) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPushAll(key, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPushAll(key, value);
return true; return true;
} }
/** /**
* 将list放入缓存 * 将list放入缓存
* *
* @param key 键
* @param key 键
* @param value 值 * @param value 值
* @param time 时间(秒)
* @param time 时间(秒)
* @return * @return
*/ */
public boolean lSet(String key, List<Object> value, long time) { public boolean lSet(String key, List<Object> value, long time) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPushAll(key, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().rightPushAll(key, value);
if (time > 0) if (time > 0)
expire(key, time); expire(key, time);
return true; return true;
} }
/** /**
* 根据索引修改list中的某条数据 * 根据索引修改list中的某条数据
*
* @param key 键 * @param key 键
* @param index 索引 * @param index 索引
* @param value 值 * @param value 值
* @return * @return
*/ */
public boolean lUpdateIndex(String key, long index, Object value) { public boolean lUpdateIndex(String key, long index, Object value) {
redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().set(key, index, value); redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().set(key, index, value);
return true; return true;
} }
/** /**
* 移除N个值为value * 移除N个值为value
*
* @param key 键 * @param key 键
* @param count 移除多少个 * @param count 移除多少个
* @param value 值 * @param value 值
* @return 移除的个数 * @return 移除的个数
*/ */
public long lRemove(String key, long count, Object value) { public long lRemove(String key, long count, Object value) {
Long remove = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().remove(key, count, value); Long remove = redisConfig.getRedisTemplateByDb(MathUtil.getIndex(key)).opsForList().remove(key, count, value);
return remove; return remove;
} }
public RedisTemplate<String, Object> getRedisTemplateByDb(int db){ public RedisTemplate<String, Object> getRedisTemplateByDb(int db) {
return redisConfig.getRedisTemplateByDb(db); return redisConfig.getRedisTemplateByDb(db);
} }
public Object getDB15RedisHGet(String redisKey, String item) {
return redisConfig.getRedisTemplateByDb(15).opsForHash().get(redisKey, item);
}
public Object getDB15RedisGet(String redisKey) {
return redisConfig.getRedisTemplateByDb(15).opsForValue().get(redisKey);
}
} }
...@@ -57,7 +57,7 @@ public class FieldsServiceImpl implements KylinFieldsService { ...@@ -57,7 +57,7 @@ public class FieldsServiceImpl implements KylinFieldsService {
public KylinFieldsVo fieldDetails(String fieldId) { public KylinFieldsVo fieldDetails(String fieldId) {
KylinFieldsVo info = null; KylinFieldsVo info = null;
// 获取 redis数据 // 获取 redis数据
info = (KylinFieldsVo) redisUtil.hget(KylinRedisConst.FIELDS, fieldId + ""); info = (KylinFieldsVo) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS, fieldId + "");
//不存在 获取 mongo数据 //不存在 获取 mongo数据
if (null == info) { if (null == info) {
info = mongoTemplate.findOne(Query.query(Criteria.where("fieldsId").is(fieldId)), KylinFieldsVo.class, KylinFieldsVo.class.getSimpleName()); info = mongoTemplate.findOne(Query.query(Criteria.where("fieldsId").is(fieldId)), KylinFieldsVo.class, KylinFieldsVo.class.getSimpleName());
......
...@@ -208,7 +208,7 @@ public class DataUtils { ...@@ -208,7 +208,7 @@ public class DataUtils {
*/ */
public String getAgentInfoName(String agentId) { public String getAgentInfoName(String agentId) {
String redisKey = KylinRedisConst.PERFORMANCES_AGENT_INFO.concat(agentId); String redisKey = KylinRedisConst.PERFORMANCES_AGENT_INFO.concat(agentId);
String name = (String) redisUtil.hget(redisKey, "name"); String name = (String) redisUtil.getDB15RedisHGet(redisKey, "name");
// String name = ""; // String name = "";
return name; return name;
} }
......
...@@ -16,12 +16,10 @@ import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo; ...@@ -16,12 +16,10 @@ import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketPartnerVo;
import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo; import com.liquidnet.service.kylin.dto.vo.partner.KylinTicketTimesPartnerVo;
import com.liquidnet.service.kylin.entity.*; import com.liquidnet.service.kylin.entity.*;
import com.liquidnet.service.kylin.mapper.*; import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.*;
import com.liquidnet.service.platform.utils.DataUtils; import com.liquidnet.service.platform.utils.DataUtils;
import com.liquidnet.service.platform.utils.PerformanceVoTask; import com.liquidnet.service.platform.utils.PerformanceVoTask;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
...@@ -150,7 +148,7 @@ public class DataImpl { ...@@ -150,7 +148,7 @@ public class DataImpl {
performances.setDescribes(resultData.getString("describe")); performances.setDescribes(resultData.getString("describe"));
performances.setDetails(resultData.getString("detail")); performances.setDetails(resultData.getString("detail"));
performances.setCityId(Integer.parseInt(resultData.getString("city_id"))); performances.setCityId(Integer.parseInt(resultData.getString("city_id")));
performances.setCityName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + resultData.getInt("field_id"), "city_name")); performances.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + resultData.getInt("field_id"), "city_name"));
performances.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]"); performances.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]");
performances.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_start").toString())); performances.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_start").toString()));
performances.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_end").toString())); performances.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmssS.parse(resultData.getTimestamp("time_end").toString()));
...@@ -203,7 +201,7 @@ public class DataImpl { ...@@ -203,7 +201,7 @@ public class DataImpl {
performancePartnerVo.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmss.format(performances.getTimeStart())); performancePartnerVo.setTimeStart(DateUtil.Formatter.yyyyMMddHHmmss.format(performances.getTimeStart()));
performancePartnerVo.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmss.format(performances.getTimeEnd())); performancePartnerVo.setTimeEnd(DateUtil.Formatter.yyyyMMddHHmmss.format(performances.getTimeEnd()));
performancePartnerVo.setFieldId(performanceRelations.getFieldId()); performancePartnerVo.setFieldId(performanceRelations.getFieldId());
performancePartnerVo.setFieldName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "name")); performancePartnerVo.setFieldName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "name"));
performancePartnerVo.setNotice(performances.getNotice()); performancePartnerVo.setNotice(performances.getNotice());
performancePartnerVo.setSponsorId(performances.getSponsorId()); performancePartnerVo.setSponsorId(performances.getSponsorId());
performancePartnerVo.setSponsorType(performances.getSponsorType()); performancePartnerVo.setSponsorType(performances.getSponsorType());
...@@ -672,7 +670,7 @@ public class DataImpl { ...@@ -672,7 +670,7 @@ public class DataImpl {
orderTicketVo.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]"); orderTicketVo.setNoticeImage("[{\"id\":1,\"sort\":1,\"message\":\"因演出票品非普通商品,其背后承载的文化服务具有时效性、稀缺性等特征,故不适用7天无理由退货政策。因“不可抗力”导致的演出取消或延期除外。\",\"title\":\"门票退换\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c45722882a13.png\"},{\"id\":7,\"sort\":2,\"message\":\"凭订单二维码或手机号兑票入场,二维码或手机号请勿泄露,以免影响入场。个人原因导致的信息泄露,主办方/平台方不承担任何责任。\",\"title\":\"电子票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456d9482fb9.png\"},{\"id\":3,\"sort\":3,\"message\":\"本场演出不设座位,均为站席观演。\",\"title\":\"仅设站席\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/01/21/5c456e93db0b9.png\"},{\"id\":12,\"sort\":4,\"message\":\"每场现场票数量由场地方决定,具体请到现场询问。\",\"title\":\"现场票\",\"type\":\"image\",\"imgUrl\":\"http://img-zhengzai-tv.oss-cn-hangzhou.aliyuncs.com/partner/2019/06/17/5d07647eaa55f.png\"}]");
orderTicketVo.setNotice(notice); orderTicketVo.setNotice(notice);
orderTicketVo.setTicketType(ticketType); orderTicketVo.setTicketType(ticketType);
orderTicketVo.setFieldName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + orderTicketRelations.getPerformanceId(), "name")); orderTicketVo.setFieldName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + orderTicketRelations.getPerformanceId(), "name"));
//入场人 //入场人
String enterSql = "select * from order_ticket_entities where order_id = " + orderTickets.getOrderTicketsId(); //设置的预编译语句格式 String enterSql = "select * from order_ticket_entities where order_id = " + orderTickets.getOrderTicketsId(); //设置的预编译语句格式
...@@ -932,13 +930,12 @@ public class DataImpl { ...@@ -932,13 +930,12 @@ public class DataImpl {
// redis 库存迁移 // redis 库存迁移
@Autowired @Autowired
// private RedisTemplate<String, Object> redisTemplate;
public boolean SurplusRedis(){ public boolean SurplusRedis(){
List<KylinTicketStatus> ticketStatus = ticketStatusMapper.selectList(Wrappers.lambdaQuery(KylinTicketStatus.class)); List<KylinTicketStatus> ticketStatus = ticketStatusMapper.selectList(Wrappers.lambdaQuery(KylinTicketStatus.class));
for (KylinTicketStatus item : ticketStatus){ for (KylinTicketStatus item : ticketStatus){
String ticketId = item.getTicketId(); String ticketId = item.getTicketId();
// dataUtils.setSurplusGeneral(ticketId, (Integer) redisTemplate.opsForValue().get(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_GENERAL)); dataUtils.setSurplusGeneral(ticketId, (Integer) redisUtil.getDB15RedisGet(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_GENERAL));
// dataUtils.setSurplusExchange(ticketId, (Integer) redisTemplate.opsForValue().get(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_EXCHANGE)); dataUtils.setSurplusExchange(ticketId, (Integer) redisUtil.getDB15RedisGet(KylinRedisConst.PERFORMANCES_INVENTORY + ticketId + ":" + KylinRedisConst.SURPLUS_EXCHANGE));
} }
return true; return true;
} }
......
package com.liquidnet.service.platform.service.impl.partner; package com.liquidnet.service.platform.service.impl.partner;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -143,7 +142,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor ...@@ -143,7 +142,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
performancePartnerVo.setRoadShowId("0"); performancePartnerVo.setRoadShowId("0");
performancePartnerVo.setProjectId("0"); performancePartnerVo.setProjectId("0");
performancePartnerVo.setIsShow(1); performancePartnerVo.setIsShow(1);
performancePartnerVo.setFieldName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performancePartnerVo.getFieldId(), "name")); performancePartnerVo.setFieldName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performancePartnerVo.getFieldId(), "name"));
performancePartnerVo.setNoticeImage(dataUtils.getBuyNoticeJsonString(step1Param.getNoticeIds())); performancePartnerVo.setNoticeImage(dataUtils.getBuyNoticeJsonString(step1Param.getNoticeIds()));
mongoTemplate.insert( mongoTemplate.insert(
...@@ -176,7 +175,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor ...@@ -176,7 +175,7 @@ public class KylinPerformancesPartnerServiceImpl extends ServiceImpl<KylinPerfor
performancePartnerVo.setIsSubmit(0); performancePartnerVo.setIsSubmit(0);
performancePartnerVo.setStatus(0); performancePartnerVo.setStatus(0);
performancePartnerVo.setNoticeImage(dataUtils.getBuyNoticeJsonString(step1Param.getNoticeIds())); performancePartnerVo.setNoticeImage(dataUtils.getBuyNoticeJsonString(step1Param.getNoticeIds()));
performancePartnerVo.setFieldName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performancePartnerVo.getFieldId(), "name")); performancePartnerVo.setFieldName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performancePartnerVo.getFieldId(), "name"));
performancePartnerVo.setNoticeImage(dataUtils.getBuyNoticeJsonString(step1Param.getNoticeIds())); performancePartnerVo.setNoticeImage(dataUtils.getBuyNoticeJsonString(step1Param.getNoticeIds()));
if (data != null) { // 有修改记录 if (data != null) { // 有修改记录
performancePartnerVo.setIsTrueName(data.getIsTrueName()); performancePartnerVo.setIsTrueName(data.getIsTrueName());
......
...@@ -53,12 +53,12 @@ public class MongoVoUtils { ...@@ -53,12 +53,12 @@ public class MongoVoUtils {
KylinPerformanceRelations p3 = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId)); KylinPerformanceRelations p3 = performanceRelationsMapper.selectOne(new UpdateWrapper<KylinPerformanceRelations>().eq("performance_id", performancesId));
//场地相关数据 //场地相关数据
KylinFields fields = new KylinFields(); KylinFields fields = new KylinFields();
String cityName = (String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name"); String cityName = (String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name");
fields.setCityId(Integer.parseInt((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_id"))); fields.setCityId(Integer.parseInt((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_id")));
fields.setLatitude((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "latitude")); fields.setLatitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "latitude"));
fields.setLongitude((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "longitude")); fields.setLongitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "longitude"));
fields.setCityName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name")); fields.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "city_name"));
fields.setName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "name")); fields.setName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + p3.getFieldId(), "name"));
//相关状态时间初始变量 //相关状态时间初始变量
LocalDateTime stopSellTime = null; LocalDateTime stopSellTime = null;
......
...@@ -257,8 +257,8 @@ public class PerformanceVoTask { ...@@ -257,8 +257,8 @@ public class PerformanceVoTask {
performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(kylinPerformanceMisVo.getCreatedAt()))); performances.setCreatedAt(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(kylinPerformanceMisVo.getCreatedAt())));
performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(kylinPerformanceMisVo.getTimeStart()))); performances.setTimeStart(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(kylinPerformanceMisVo.getTimeStart())));
performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(kylinPerformanceMisVo.getTimeEnd()))); performances.setTimeEnd(DateUtil.asLocalDateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(kylinPerformanceMisVo.getTimeEnd())));
performances.setCityName((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_name")); performances.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_name"));
performances.setCityId(Integer.parseInt((String) redisUtil.hget(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_id"))); performances.setCityId(Integer.parseInt((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + performanceRelations.getFieldId(), "city_id")));
performances.setUpdatedAt(updatedAt); performances.setUpdatedAt(updatedAt);
performanceStatus.setPerformanceId(performances.getPerformancesId()); performanceStatus.setPerformanceId(performances.getPerformancesId());
......
...@@ -7,7 +7,7 @@ import com.liquidnet.commons.lang.util.DateUtil; ...@@ -7,7 +7,7 @@ import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo; import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.sweet.constant.SweetConstant; import com.liquidnet.service.sweet.constant.SweetConstant;
import com.liquidnet.service.sweet.dto.SweetManualAppletDto; import com.liquidnet.service.sweet.dto.SweetManualAppletDto;
import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto; import com.liquidnet.service.sweet.dto.SweetManualArtistList2Dto;
...@@ -55,10 +55,10 @@ public class RedisDataUtils { ...@@ -55,10 +55,10 @@ public class RedisDataUtils {
if(!item.getIsMember().equals(1)){ if(!item.getIsMember().equals(1)){
item.setTimeSell(DateUtil.format(DateUtil.addMin(DateUtil.parse(item.getTimeSell(),"yyyy-MM-dd HH:mm:ss"),item.getPayCountdownMinute()),DateUtil.Formatter.yyyyMMddHHmmss)); item.setTimeSell(DateUtil.format(DateUtil.addMin(DateUtil.parse(item.getTimeSell(),"yyyy-MM-dd HH:mm:ss"),item.getPayCountdownMinute()),DateUtil.Formatter.yyyyMMddHHmmss));
} }
item.setFieldName((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "name")); item.setFieldName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "name"));
item.setCityName((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "city_name")); item.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "city_name"));
item.setLatitude((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "latitude")); item.setLatitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "latitude"));
item.setLongitude((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "longitude")); item.setLongitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "longitude"));
} }
redisUtil.set(redisKey, data); redisUtil.set(redisKey, data);
return data; return data;
......
...@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil; ...@@ -6,6 +6,7 @@ import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.DateUtil; import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst; import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.sweet.constant.SweetConstant; import com.liquidnet.service.sweet.constant.SweetConstant;
import com.liquidnet.service.sweet.dto.*; import com.liquidnet.service.sweet.dto.*;
import com.liquidnet.service.sweet.entity.*; import com.liquidnet.service.sweet.entity.*;
...@@ -48,10 +49,10 @@ public class RedisMDSKDataUtils { ...@@ -48,10 +49,10 @@ public class RedisMDSKDataUtils {
if(!item.getIsMember().equals(1)){ if(!item.getIsMember().equals(1)){
item.setTimeSell(DateUtil.format(DateUtil.addMin(DateUtil.parse(item.getTimeSell(),"yyyy-MM-dd HH:mm:ss"),-item.getPayCountdownMinute()),DateUtil.Formatter.yyyyMMddHHmmss)); item.setTimeSell(DateUtil.format(DateUtil.addMin(DateUtil.parse(item.getTimeSell(),"yyyy-MM-dd HH:mm:ss"),-item.getPayCountdownMinute()),DateUtil.Formatter.yyyyMMddHHmmss));
} }
item.setFieldName((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "name")); item.setFieldName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "name"));
item.setCityName((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "city_name")); item.setCityName((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "city_name"));
item.setLatitude((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "latitude")); item.setLatitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "latitude"));
item.setLongitude((String) redisUtil.hget("kylin:fields:id" + ":" + item.getFieldId(), "longitude")); item.setLongitude((String) redisUtil.getDB15RedisHGet(KylinRedisConst.FIELDS + ":" + item.getFieldId(), "longitude"));
} }
redisUtil.set(redisKey, data); redisUtil.set(redisKey, data);
return data; return data;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment