Commit 07c311c0 authored by alex yao's avatar alex yao

feat:getVariableList 按字母排序

parent 4935dfe7
...@@ -33,12 +33,15 @@ import javax.annotation.Resource; ...@@ -33,12 +33,15 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.text.Collator;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Component @Component
public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest { public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
private final Collator collator = Collator.getInstance(Locale.CHINA);
@Resource @Resource
private BizAgentApplicationInfoService bizAgentApplicationInfoService; private BizAgentApplicationInfoService bizAgentApplicationInfoService;
...@@ -367,7 +370,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest { ...@@ -367,7 +370,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
result.add(valueMemoryDto); result.add(valueMemoryDto);
} }
} }
return result.stream().sorted(Comparator.comparing(AgentApplicationValueMemoryDto::getKey)).collect(Collectors.toList()); return result.stream().sorted(Comparator.comparing(AgentApplicationValueMemoryDto::getKey, collator)).collect(Collectors.toList());
} }
@Override @Override
......
...@@ -24,7 +24,10 @@ import java.util.Map; ...@@ -24,7 +24,10 @@ import java.util.Map;
@Service @Service
public class SetLongMemoryFunction extends AbstractLargeModelFunction { public class SetLongMemoryFunction extends AbstractLargeModelFunction {
private String desc = "该方法仅用来保存用户想记录的内容,不能通过该方法进行查询。"; private final String desc = "该方法仅用来保存用户想记录的内容,不能通过该方法进行查询。";
private final Long expireTime = 30 * 60 * 24L; // 30天有效期
@Resource @Resource
private RedisService redisService; private RedisService redisService;
...@@ -48,7 +51,7 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction { ...@@ -48,7 +51,7 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction {
// 提取 content // 提取 content
String contents = jsonObject.getStr("content"); String contents = jsonObject.getStr("content");
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + key + ":" + BlContext.getCurrentUserNotException().getUserId().toString(); String contentKey = SetLongMemoryConstants.REDIS_PREFIX + key + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
redisService.hset(contentKey, DateUtils.getCurrTime(), contents); redisService.hset(contentKey, DateUtils.getCurrTime(), contents, expireTime);
return "SUCCESS"; return "SUCCESS";
} }
......
...@@ -20,7 +20,10 @@ import java.util.Map; ...@@ -20,7 +20,10 @@ import java.util.Map;
@Service @Service
public class SetValueMemoryFunction extends AbstractLargeModelFunction { public class SetValueMemoryFunction extends AbstractLargeModelFunction {
private String desc = "该方法仅用enum给定的内容名来保存用户想记录的内容值,不可使用该方法进行查询"; private final String desc = "该方法仅用enum给定的内容名来保存用户想记录的内容值,不可使用该方法进行查询";
private final Long expireTime = 30 * 60 * 24L; // 30天有效期
@Resource @Resource
private RedisService redisService; private RedisService redisService;
...@@ -49,7 +52,7 @@ public class SetValueMemoryFunction extends AbstractLargeModelFunction { ...@@ -49,7 +52,7 @@ public class SetValueMemoryFunction extends AbstractLargeModelFunction {
} }
} }
result.put(contentName, contentValue); result.put(contentName, contentValue);
redisService.hmset(contentKey, result); redisService.hmset(contentKey, result, expireTime);
return "SUCCESS"; return "SUCCESS";
} }
......
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