提交 6a48437c 作者: 925993793@qq.com

研究中心-列表页数量统计、文件上传,左侧同样不展示复合专题等bug处理

上级 7e8df423
...@@ -338,6 +338,7 @@ public class FileController { ...@@ -338,6 +338,7 @@ public class FileController {
List<FileDataVO> informationList = reader.read(0, 1, FileDataVO.class); List<FileDataVO> informationList = reader.read(0, 1, FileDataVO.class);
informationService.importDataInfo(informationList,subjectId); informationService.importDataInfo(informationList,subjectId);
} catch (IOException e) { } catch (IOException e) {
log.info("专题-{},批量插入数据异常",subjectId);
e.printStackTrace(); e.printStackTrace();
} }
}); });
......
...@@ -889,13 +889,18 @@ public class SubjectManageController { ...@@ -889,13 +889,18 @@ public class SubjectManageController {
@PostMapping("/bindInfoSourceLabel") @PostMapping("/bindInfoSourceLabel")
public Result<?> bindInfoSourceLabel(@RequestBody SubjectSourceTagVO subjectSourceTagVO) { public Result<?> bindInfoSourceLabel(@RequestBody SubjectSourceTagVO subjectSourceTagVO) {
List<InfoSourceLabelVO> labelList = subjectSourceTagVO.getLabelList(); List<InfoSourceLabelVO> labelList = subjectSourceTagVO.getLabelList();
if (CollectionUtils.isEmpty(labelList)) {
return Result.OK();
}
String subjectId = subjectSourceTagVO.getSubjectId(); String subjectId = subjectSourceTagVO.getSubjectId();
if (StringUtils.isEmpty(subjectId)) { if (StringUtils.isEmpty(subjectId)) {
return Result.FAIL("专题id不能为空"); return Result.FAIL("专题id不能为空");
} }
//支持全部删除
//不管有没有传值,先删后增
LambdaQueryWrapper<SubjectInfoSourceMap> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SubjectInfoSourceMap::getSubjectId, subjectId).eq(SubjectInfoSourceMap::getType, 12);
int count = subjectInfoSourceMapService.count(queryWrapper);
if (count > 0) {
subjectInfoSourceMapService.remove(queryWrapper);
}
List<SubjectInfoSourceMap> dataList = new ArrayList<>(); List<SubjectInfoSourceMap> dataList = new ArrayList<>();
for (InfoSourceLabelVO infoSourceLabelVO : labelList) { for (InfoSourceLabelVO infoSourceLabelVO : labelList) {
List<InfoSourceLabelItemVO> infoSourceLabelItemList = infoSourceLabelVO.getInfoSourceLabelItemList(); List<InfoSourceLabelItemVO> infoSourceLabelItemList = infoSourceLabelVO.getInfoSourceLabelItemList();
...@@ -913,13 +918,9 @@ public class SubjectManageController { ...@@ -913,13 +918,9 @@ public class SubjectManageController {
dataList.add(subjectInfoSourceMap); dataList.add(subjectInfoSourceMap);
} }
} }
LambdaQueryWrapper<SubjectInfoSourceMap> queryWrapper = Wrappers.lambdaQuery(); if (CollectionUtils.isNotEmpty(dataList)) {
queryWrapper.eq(SubjectInfoSourceMap::getSubjectId, subjectId).eq(SubjectInfoSourceMap::getType, 12); subjectInfoSourceMapService.saveBatch(dataList);
int count = subjectInfoSourceMapService.count(queryWrapper);
if (count > 0) {
subjectInfoSourceMapService.remove(queryWrapper);
} }
subjectInfoSourceMapService.saveBatch(dataList);
//同步配置到采集 //同步配置到采集
configurationMessageService.bindInfoSourceSend(subjectId); configurationMessageService.bindInfoSourceSend(subjectId);
return Result.OK(); return Result.OK();
......
...@@ -140,13 +140,14 @@ public class SubjectTypeController { ...@@ -140,13 +140,14 @@ public class SubjectTypeController {
public Result<?> subjectAndTypeTree(@RequestParam(required = false) Integer facePublic, public Result<?> subjectAndTypeTree(@RequestParam(required = false) Integer facePublic,
@RequestParam(required = false) String environment, @RequestParam(required = false) String environment,
@RequestParam(required = false) String flagCode, @RequestParam(required = false) String flagCode,
@RequestParam(defaultValue = "1") Integer subjectType,
HttpServletRequest request) { HttpServletRequest request) {
UserVo loginUser = UserUtil.getLoginUser(); UserVo loginUser = UserUtil.getLoginUser();
List<SubjectTreeVO> dataList = null; List<SubjectTreeVO> dataList = null;
if (facePublic == null) { if (facePublic == null) {
dataList = subjectTypeService.subjectAndTypeTree(environment); dataList = subjectTypeService.subjectAndTypeTree(subjectType,environment);
} else if (facePublic == 1) { } else if (facePublic == 1) {
dataList = subjectTypeService.subjectsByFacePublic(facePublic,environment,loginUser.getUsername(),flagCode,request); dataList = subjectTypeService.subjectsByFacePublic(subjectType,facePublic,environment,loginUser.getUsername(),flagCode,request);
} }
return Result.OK(dataList); return Result.OK(dataList);
} }
......
...@@ -1856,12 +1856,12 @@ public class EsService { ...@@ -1856,12 +1856,12 @@ public class EsService {
* *
* @param subjectIds 专题id集合 * @param subjectIds 专题id集合
* @param auditStatus 审核状态-平台(null-全部;1-通过;2-未审核;3-暂定;4-删除;5-免审核) * @param auditStatus 审核状态-平台(null-全部;1-通过;2-未审核;3-暂定;4-删除;5-免审核)
* @param auditStatus 审核状态-研究中心(0-全部;1-模型推荐;2-精选;3-待定;4-移除) * @param status 审核状态-研究中心(0-全部;1-模型推荐;2-精选;3-待定;4-移除)
* @param type 是否多层聚合(先按专题,再按发布时间) * @param type 是否多层聚合(先按专题,再按发布时间)
* @author lkg * @author lkg
* @date 2025/3/25 * @date 2025/3/25
*/ */
public List<StatisticVO> subjectStatisticInfo(List<String> subjectIds, Integer auditStatus,Integer status, Integer type) { public List<StatisticVO> subjectStatisticInfo(List<String> subjectIds, Integer auditStatus, Integer status, Integer type) {
List<StatisticVO> list = new ArrayList<>(); List<StatisticVO> list = new ArrayList<>();
SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX); SearchRequest searchRequest = new SearchRequest(Constants.SUBJECT_INDEX);
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
...@@ -2075,7 +2075,7 @@ public class EsService { ...@@ -2075,7 +2075,7 @@ public class EsService {
public BoolQueryBuilder buildQuery(InfoDataSearchCondition searchCondition, List<String> subjectIdList) { public BoolQueryBuilder buildQuery(InfoDataSearchCondition searchCondition, List<String> subjectIdList) {
//判断是否需要查询发布时间为空的数据 //判断是否需要查询发布时间为空的数据
boolean timeFlag = false; boolean timeFlag = false;
if(StringUtils.isEmpty(searchCondition.getStartTime()) && StringUtils.isEmpty(searchCondition.getEndTime())) { if (StringUtils.isEmpty(searchCondition.getStartTime()) && StringUtils.isEmpty(searchCondition.getEndTime())) {
//前端没有穿时间参数时,需要查询发布时间为空的数据 //前端没有穿时间参数时,需要查询发布时间为空的数据
timeFlag = true; timeFlag = true;
} }
...@@ -2115,13 +2115,13 @@ public class EsService { ...@@ -2115,13 +2115,13 @@ public class EsService {
} }
} }
//时间过滤筛选-专题配置 //时间过滤筛选-专题配置
if (StringUtils.isNotEmpty(configStartTime) && (StringUtils.isEmpty(searchCondition.getStartTime())||configStartTime.compareTo(searchCondition.getStartTime())>0)) { if (StringUtils.isNotEmpty(configStartTime) && (StringUtils.isEmpty(searchCondition.getStartTime()) || configStartTime.compareTo(searchCondition.getStartTime()) > 0)) {
searchCondition.setStartTime(configStartTime); searchCondition.setStartTime(configStartTime);
} }
if(StringUtils.isEmpty(configEndTime)){ if (StringUtils.isEmpty(configEndTime)) {
configEndTime = EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date())); configEndTime = EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date()));
} }
if (StringUtils.isEmpty(searchCondition.getEndTime())||configEndTime.compareTo(searchCondition.getEndTime())<0) { if (StringUtils.isEmpty(searchCondition.getEndTime()) || configEndTime.compareTo(searchCondition.getEndTime()) < 0) {
searchCondition.setEndTime(configEndTime); searchCondition.setEndTime(configEndTime);
} }
} }
...@@ -2282,7 +2282,7 @@ public class EsService { ...@@ -2282,7 +2282,7 @@ public class EsService {
configDateQueryBuilder.must(QueryBuilders.rangeQuery("publishDate").lte(EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date())))); configDateQueryBuilder.must(QueryBuilders.rangeQuery("publishDate").lte(EsDateUtil.esFieldDateFormat(DateUtil.dateToString(new Date()))));
} }
publishDateQueryBuilder.should(configDateQueryBuilder); publishDateQueryBuilder.should(configDateQueryBuilder);
if(timeFlag){ if (timeFlag) {
publishDateQueryBuilder.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("publishDate"))); publishDateQueryBuilder.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("publishDate")));
} }
boolQuery.must(publishDateQueryBuilder); boolQuery.must(publishDateQueryBuilder);
......
...@@ -78,7 +78,7 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> { ...@@ -78,7 +78,7 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> {
* @author lkg * @author lkg
* @date 2025/1/7 * @date 2025/1/7
*/ */
List<SubjectTreeVO> subjectsByFacePublic(@Param("facePublic") Integer facePublic,@Param("environment") String environment,@Param("username") String username List<SubjectTreeVO> subjectsByFacePublic(@Param("subjectType") Integer subjectType,@Param("facePublic") Integer facePublic,@Param("environment") String environment,@Param("username") String username
,@Param("sql") String sql); ,@Param("sql") String sql);
/** /**
...@@ -87,7 +87,7 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> { ...@@ -87,7 +87,7 @@ public interface SubjectTypeMapper extends BaseMapper<SubjectType> {
* @author lkg * @author lkg
* @date 2024/4/29 * @date 2024/4/29
*/ */
List<SubjectTreeVO> subjectAndTypeTree(@Param("username") String createBy,@Param("environment") String environment); List<SubjectTreeVO> subjectAndTypeTree(@Param("subjectType") Integer subjectType,@Param("username") String createBy,@Param("environment") String environment);
/** /**
* 获取分类下的专题列表 * 获取分类下的专题列表
......
...@@ -70,6 +70,9 @@ ...@@ -70,6 +70,9 @@
from subject s from subject s
where where
((s.face_public = #{facePublic} and s.create_by = #{username}) or (s.face_public = #{facePublic} and ${sql})) ((s.face_public = #{facePublic} and s.create_by = #{username}) or (s.face_public = #{facePublic} and ${sql}))
<if test="subjectType!=null">
and s.subject_type = #{subjectType}
</if>
<if test="environment!=null and environment != ''"> <if test="environment!=null and environment != ''">
and s.environment = #{environment} and s.environment = #{environment}
</if> </if>
...@@ -120,6 +123,9 @@ ...@@ -120,6 +123,9 @@
s.create_time s.create_time
from subject s from subject s
where 1 = 1 where 1 = 1
<if test="subjectType!=null">
and s.subject_type = #{subjectType}
</if>
<if test="username!=null and username != ''"> <if test="username!=null and username != ''">
and s.create_by = #{username} and s.create_by = #{username}
</if> </if>
......
...@@ -80,16 +80,18 @@ public interface ISubjectTypeService extends IService<SubjectType> { ...@@ -80,16 +80,18 @@ public interface ISubjectTypeService extends IService<SubjectType> {
* @author lkg * @author lkg
* @date 2025/1/7 * @date 2025/1/7
*/ */
List<SubjectTreeVO> subjectsByFacePublic(Integer facePublic,String environment,String username,String flagCode, List<SubjectTreeVO> subjectsByFacePublic(Integer subjectType,Integer facePublic,String environment,String username,String flagCode,
HttpServletRequest request); HttpServletRequest request);
/** /**
* 专题和分类列表-研究中心 * 专题和分类列表-研究中心
* *
* @param subjectType 类别(1-专题;3-复合专题)
* @param environment 环境
* @author lkg * @author lkg
* @date 2024/12/26 * @date 2025/6/4
*/ */
List<SubjectTreeVO> subjectAndTypeTree(String environment); List<SubjectTreeVO> subjectAndTypeTree(Integer subjectType,String environment);
/** /**
* 获取分类下的所有节点id集合-研究中心 * 获取分类下的所有节点id集合-研究中心
......
...@@ -345,7 +345,7 @@ public class CommonServiceImpl implements CommonService { ...@@ -345,7 +345,7 @@ public class CommonServiceImpl implements CommonService {
@Override @Override
public List<LabelItemMapVO> infoSourceLabelsBySidList(List<String> sidList) { public List<LabelItemMapVO> infoSourceLabelsBySidList(List<String> sidList) {
List<LabelItemMapVO> clbLabelItems = new ArrayList<>(); List<LabelItemMapVO> clbLabelItems = new ArrayList<>();
if (CollectionUtils.isEmpty(sidList)) { if (CollectionUtils.isNotEmpty(sidList)) {
clbLabelItems = commonMapper.infoSourceLabelsBySidList(sidList); clbLabelItems = commonMapper.infoSourceLabelsBySidList(sidList);
} }
return clbLabelItems; return clbLabelItems;
......
...@@ -1067,7 +1067,8 @@ public class InformationServiceImpl implements InformationService { ...@@ -1067,7 +1067,8 @@ public class InformationServiceImpl implements InformationService {
specialInformation.setPublishDate(EsDateUtil.esFieldDateFormat(info.getPublishDate())); specialInformation.setPublishDate(EsDateUtil.esFieldDateFormat(info.getPublishDate()));
} }
if (StringUtils.isNotEmpty(info.getContent())) { if (StringUtils.isNotEmpty(info.getContent())) {
specialInformation.setContent(info.getContent()); specialInformation.setContent(Jsoup.parse(info.getContent()).text());
specialInformation.setContentWithTag(info.getContent());
} }
if (StringUtils.isNotEmpty(info.getSummary())) { if (StringUtils.isNotEmpty(info.getSummary())) {
specialInformation.setContent(info.getSummary()); specialInformation.setContent(info.getSummary());
...@@ -1089,6 +1090,7 @@ public class InformationServiceImpl implements InformationService { ...@@ -1089,6 +1090,7 @@ public class InformationServiceImpl implements InformationService {
dataList.add(specialInformation); dataList.add(specialInformation);
} }
esOpUtil.docSaveBulk(index, dataList); esOpUtil.docSaveBulk(index, dataList);
log.info("专题-{},批量插入-{}-条数据完成",subjectId, lists.size());
} }
} }
......
...@@ -115,6 +115,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -115,6 +115,9 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
@Value("${clb.subject.default.processing.advanceMonth}") @Value("${clb.subject.default.processing.advanceMonth}")
private Integer defaultAdvanceMonth; private Integer defaultAdvanceMonth;
//专题信息数量本地缓存
LocalCache<String, Map<String,StatisticVO>> numLocalCache = new LocalCache<>(60 * 1000);
@Override @Override
public Page<SubjectPage> pageList(SubjectCondition subjectCondition, Integer pageNo, Integer pageSize) { public Page<SubjectPage> pageList(SubjectCondition subjectCondition, Integer pageNo, Integer pageSize) {
...@@ -217,7 +220,50 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -217,7 +220,50 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
}); });
} }
//专题统计信息-总数量、最新资讯日期 for (Subject subject : subjects) {
String subjectId = subject.getId();
String estimateStatus = subject.getEstimateStatus();
SubjectStatisticInfo subjectStatisticInfo = new SubjectStatisticInfo();
subjectStatisticInfo.setSubjectId(subjectId);
if (infoSourceNumMap.containsKey(subjectId)) {
subjectStatisticInfo.setBindSourceNum(infoSourceNumMap.get(subjectId));
} else {
subjectStatisticInfo.setBindSourceNum(sourceCountMap.get(subjectId) == null ? 0 : sourceCountMap.get(subjectId));
}
subjectStatisticInfo.setBindKeywordNum(keyWordsNumMap.get(subjectId) == null ? 0 : keyWordsNumMap.get(subjectId));
StatisticVO totalAndLatestDate;
StatisticVO unCheckNum;
StatisticVO modelNum;
List<String> subjectIdList = new ArrayList<>();
subjectIdList.add(subjectId);
if (!(StringUtils.isEmpty(estimateStatus) || "已完成".equals(estimateStatus))) {
totalAndLatestDate = esService.subjectStatisticInfo(subjectIdList, null, null, 1).get(0);
unCheckNum = esService.subjectStatisticInfo(subjectIdList, 2, null, null).get(0);
modelNum = esService.subjectStatisticInfo(subjectIdList, null, 1, null).get(0);
} else {
if (numLocalCache.get(subjectId) == null) {
totalAndLatestDate = esService.subjectStatisticInfo(subjectIdList, null, null, 1).get(0);
unCheckNum = esService.subjectStatisticInfo(subjectIdList, 2, null, null).get(0);
modelNum = esService.subjectStatisticInfo(subjectIdList, null, 1, null).get(0);
Map<String, StatisticVO> numMap = new HashMap<>();
numMap.put("totalAndLatestDate", totalAndLatestDate);
numMap.put("unCheckNum", unCheckNum);
numMap.put("modelNum", modelNum);
numLocalCache.put(subjectId, numMap);
} else {
Map<String, StatisticVO> numMap = numLocalCache.get(subjectId);
totalAndLatestDate = numMap.get("totalAndLatestDate");
unCheckNum = numMap.get("unCheckNum");
modelNum = numMap.get("modelNum");
}
}
subjectStatisticInfo.setTotalNum(totalAndLatestDate.getCount());
subjectStatisticInfo.setLatestDataDate(totalAndLatestDate.getPublishDate());
subjectStatisticInfo.setUnCheckNum(unCheckNum.getCount());
subjectStatisticInfo.setModelNum(modelNum.getCount());
list.add(subjectStatisticInfo);
}
/*//专题统计信息-总数量、最新资讯日期
List<StatisticVO> totalAndLatestDateList = esService.subjectStatisticInfo(subjectIds, null,null, 1); List<StatisticVO> totalAndLatestDateList = esService.subjectStatisticInfo(subjectIds, null,null, 1);
Map<String,StatisticVO> totalAndLatestDateMap = totalAndLatestDateList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e -> e)); Map<String,StatisticVO> totalAndLatestDateMap = totalAndLatestDateList.stream().collect(Collectors.toMap(StatisticVO::getSubjectId, e -> e));
//专题统计信息-待审核数量 //专题统计信息-待审核数量
...@@ -240,7 +286,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl ...@@ -240,7 +286,7 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, Subject> impl
} }
subjectStatisticInfo.setBindKeywordNum(keyWordsNumMap.get(subjectId) == null ? 0 : keyWordsNumMap.get(subjectId)); subjectStatisticInfo.setBindKeywordNum(keyWordsNumMap.get(subjectId) == null ? 0 : keyWordsNumMap.get(subjectId));
list.add(subjectStatisticInfo); list.add(subjectStatisticInfo);
} }*/
return list; return list;
} }
......
...@@ -105,7 +105,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje ...@@ -105,7 +105,7 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
} }
@Override @Override
public List<SubjectTreeVO> subjectsByFacePublic(Integer facePublic,String environment,String username,String flagCode, public List<SubjectTreeVO> subjectsByFacePublic(Integer subjectType,Integer facePublic,String environment,String username,String flagCode,
HttpServletRequest request) { HttpServletRequest request) {
String sql = ""; String sql = "";
if(StringUtils.isNotBlank(flagCode)){ if(StringUtils.isNotBlank(flagCode)){
...@@ -123,16 +123,16 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje ...@@ -123,16 +123,16 @@ public class SubjectTypeServiceImpl extends ServiceImpl<SubjectTypeMapper, Subje
log.info("subjectsByFacePublic sql:{}",sql); log.info("subjectsByFacePublic sql:{}",sql);
} }
log.info("subjectsByFacePublic username:{},facePublic:{},environment:{},sql:{}",username,facePublic,environment,sql); log.info("subjectsByFacePublic username:{},facePublic:{},environment:{},sql:{}",username,facePublic,environment,sql);
List<SubjectTreeVO> list = baseMapper.subjectsByFacePublic(facePublic,environment,username,sql); List<SubjectTreeVO> list = baseMapper.subjectsByFacePublic(subjectType,facePublic,environment,username,sql);
log.info("subjectsByFacePublic=======list.size:{}",list.size()); log.info("subjectsByFacePublic=======list.size:{}",list.size());
return list; return list;
} }
@Override @Override
public List<SubjectTreeVO> subjectAndTypeTree(String environment) { public List<SubjectTreeVO> subjectAndTypeTree(Integer subjectType,String environment) {
String username = UserUtil.getLoginUser().getUsername(); String username = UserUtil.getLoginUser().getUsername();
List<SubjectTreeVO> tree = new ArrayList<>(); List<SubjectTreeVO> tree = new ArrayList<>();
List<SubjectTreeVO> subjectTreeVOS = baseMapper.subjectAndTypeTree(username,environment); List<SubjectTreeVO> subjectTreeVOS = baseMapper.subjectAndTypeTree(subjectType,username,environment);
if (CollectionUtils.isNotEmpty(subjectTreeVOS)) { if (CollectionUtils.isNotEmpty(subjectTreeVOS)) {
tree = TreeUtil.tree(subjectTreeVOS, "0"); tree = TreeUtil.tree(subjectTreeVOS, "0");
} }
......
package com.zzsn.event.util;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
/**
* 本地缓存,带时效性
*
* @author lkg
* @date 2025/6/4
*/
public class LocalCache<K, V> {
private final ConcurrentHashMap<K, CacheValue<V>> cache;
private final long defaultExpiryTime; // 默认过期时间(毫秒)
public LocalCache(long defaultExpiryTime) {
this.cache = new ConcurrentHashMap<>();
this.defaultExpiryTime = defaultExpiryTime;
}
public void put(K key, V value) {
put(key, value, defaultExpiryTime);
}
public void put(K key, V value, long expiryTime) {
cache.put(key, new CacheValue<>(value, System.currentTimeMillis() + expiryTime));
}
public V get(K key) {
CacheValue<V> cacheValue = cache.get(key);
if (cacheValue == null || cacheValue.isExpired()) {
cache.remove(key);
return null;
}
return cacheValue.getValue();
}
public void remove(K key) {
cache.remove(key);
}
public void clear() {
cache.clear();
}
public int size() {
return cache.size();
}
static class CacheValue<V> {
private final V value;
private final long expiryTime;
CacheValue(V value, long expiryTime) {
this.value = value;
this.expiryTime = expiryTime;
}
V getValue() {
return value;
}
boolean isExpired() {
return System.currentTimeMillis() > expiryTime;
}
}
public static void main(String[] args) throws InterruptedException {
LocalCache<String, String> cache = new LocalCache<>(2 * 1000);
cache.put("key1", "value1");
System.out.println("Get key1 immediately: " + cache.get("key1"));
TimeUnit.SECONDS.sleep(1); // 等待3秒
System.out.println("Get key1 after 3 seconds: " + cache.get("key1"));
}
}
...@@ -60,11 +60,11 @@ spring: ...@@ -60,11 +60,11 @@ spring:
password: qwer@9988&zzsn password: qwer@9988&zzsn
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
elasticsearch: elasticsearch:
uris: ["1.95.69.2:9200"] # uris: ["1.95.69.2:9200"]
# uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"] uris: ["1.95.38.69:9700","1.95.3.121:9200","1.95.87.177:9700"]
username: elastic username: elastic
password: elastic # password: elastic
# password: zzsn9988 password: zzsn9988
connection-timeout: 300000 connection-timeout: 300000
socket-timeout: 300000 socket-timeout: 300000
cloud: cloud:
...@@ -176,4 +176,4 @@ clb: ...@@ -176,4 +176,4 @@ clb:
data-permit: data-permit:
dataPermitGetQueryEntityTest: http://1.95.77.159:10089/permission/ dataPermitGetQueryEntityTest: http://1.95.77.159:10089/permission/
dataPermitGetQueryEntityProd: http://1.95.14.24:8060/ dataPermitGetQueryEntityProd: http://1.95.14.24:8060/
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论