Commit 76aea466 by HlQ

[fix] 修复存入 Redis 字典项类型错误的 bug

1 parent df7adda4
......@@ -20,7 +20,7 @@ public class FaultTypeConverter implements CustomWriteConverter<Integer, Object>
@Override
public Object convert(Integer originalData, CustomWriteContext customWriteContext) {
RMap<String, String> faultTypeMap = redissonClient.getMap(RedisKeyEnum.DICT_PREFIX.getVal() + RedisKeyEnum.FAULT_TYPE.getVal());
return faultTypeMap.getOrDefault(originalData.toString(), "故障类型不存在");
RMap<Integer, String> faultTypeMap = redissonClient.getMap(RedisKeyEnum.DICT_PREFIX.getVal() + RedisKeyEnum.FAULT_TYPE.getVal());
return faultTypeMap.getOrDefault(originalData, "故障类型不存在");
}
}
......@@ -38,7 +38,7 @@ public enum RedisKeyEnum {
PRODUCT_LINE("productLine"),
CONSTRUCTION_STATUS("constructionStatus"),
DIFF_TYPE("diffType"),
OFFSET_ITEM("offset_item"),
OFFSET_ITEM("offsetItem"),
POINT_STATUS("pointStatus"),
REPAIR_STATUS("repairStatus"),
PROJECT_SIZE("projectSize"),
......
......@@ -21,7 +21,7 @@ public class DictionaryServiceImpl extends MPJBaseServiceImpl<DictionaryMapper,
@Override
public void syncDict() {
Opt.ofEmptyAble(this.list())
.map(l -> l.stream().collect(Collectors.groupingBy(Dictionary::getType, Collectors.toMap(d -> d.getKey().toString(), Dictionary::getValue))))
.map(l -> l.stream().collect(Collectors.groupingBy(Dictionary::getType, Collectors.toMap(Dictionary::getKey, Dictionary::getValue))))
.ifPresent(m -> m.forEach((type, map) -> redissonClient.getMap(RedisKeyEnum.DICT_PREFIX.getVal() + RedisKeyEnum.getValByKey(type)).putAll(map)));
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!