Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
think-tank
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
张京坤
think-tank
Commits
26950382
提交
26950382
authored
7月 09, 2024
作者:
zgz
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
获取资讯量前十的智库国家
上级
ebf1c06e
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
638 行增加
和
5 行删除
+638
-5
LeaderCategoryController.java
...m/zzsn/thinktank/controller/LeaderCategoryController.java
+9
-0
AttachmentInfo.java
src/main/java/com/zzsn/thinktank/entity/AttachmentInfo.java
+33
-0
PolicySpecialInformation.java
...a/com/zzsn/thinktank/entity/PolicySpecialInformation.java
+21
-0
SpecialInformation.java
...in/java/com/zzsn/thinktank/entity/SpecialInformation.java
+157
-0
LeaderCategoryService.java
...ava/com/zzsn/thinktank/service/LeaderCategoryService.java
+2
-0
LeaderCategoryServiceImpl.java
...zsn/thinktank/service/impl/LeaderCategoryServiceImpl.java
+130
-4
SimRedisUtil.java
src/main/java/com/zzsn/thinktank/util/SimRedisUtil.java
+250
-0
InformationSourceVO.java
src/main/java/com/zzsn/thinktank/vo/InformationSourceVO.java
+34
-0
ThinktankCategoryStructureVo.java
...a/com/zzsn/thinktank/vo/ThinktankCategoryStructureVo.java
+2
-1
没有找到文件。
src/main/java/com/zzsn/thinktank/controller/LeaderCategoryController.java
浏览文件 @
26950382
...
@@ -92,6 +92,15 @@ public class LeaderCategoryController {
...
@@ -92,6 +92,15 @@ public class LeaderCategoryController {
}
}
/**
* 查询拥有智库资讯数量前十的国家(默认前十)
*/
@GetMapping
(
"/listTop"
)
public
Result
<?>
listTop10
(
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
Integer
num
){
log
.
info
(
"查询拥有智库资讯数量前十的国家(默认前十)"
);
return
leaderCategoryService
.
listTop10
(
num
);
}
/**
/**
* 根据名称模糊查询所有节点及父节点
* 根据名称模糊查询所有节点及父节点
...
...
src/main/java/com/zzsn/thinktank/entity/AttachmentInfo.java
0 → 100644
浏览文件 @
26950382
package
com
.
zzsn
.
thinktank
.
entity
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
@Data
@Accessors
(
chain
=
true
)
public
class
AttachmentInfo
{
//附件名称
private
String
attachmentName
;
//附件相对地址
private
String
attachmentPath
;
//附件组
private
String
group
;
//附件相对地址
private
String
attachmentFullPath
;
//附件对应的id
private
String
attachmentId
;
//扩展名称
private
String
category
;
//附件大小
private
String
fileSize
;
//总页数
private
Integer
pageSize
=
0
;
//来源
private
String
source
=
""
;
//桶名称
private
String
bucketName
;
//路径
private
String
objectKey
;
}
src/main/java/com/zzsn/thinktank/entity/PolicySpecialInformation.java
0 → 100644
浏览文件 @
26950382
package
com
.
zzsn
.
thinktank
.
entity
;
import
lombok.Data
;
import
java.util.List
;
//政策法规输出字段:
@Data
public
class
PolicySpecialInformation
extends
SpecialInformation
{
//来源 (政策发文机关)
private
String
organ
;
//政策文件分类
private
String
topicClassification
;
//政策文件分类
private
String
issuedNumber
;
//成文时间
private
String
writtenDate
;
//命中段落
private
List
<
String
>
contentList
;
}
src/main/java/com/zzsn/thinktank/entity/SpecialInformation.java
0 → 100644
浏览文件 @
26950382
package
com
.
zzsn
.
thinktank
.
entity
;
import
com.zzsn.thinktank.vo.Label
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
SpecialInformation
{
//说明:...Raw 表示原文,即原语言
//作者
private
String
author
;
private
String
authorRaw
;
//正文
private
String
content
;
private
String
contentRaw
;
//带标签正文
private
String
contentWithTag
;
private
String
contentWithTagRaw
;
//入库时间
private
String
createDate
;
//信息id
private
String
id
;
//信息来源id(信息源或者关键词)
private
String
sid
;
//语言
private
String
lang
;
private
String
langRaw
;
//来源(信息来源)
private
String
origin
;
private
String
originRaw
;
//发布时间
private
String
publishDate
;
//原始时间(网页上,没有解析之前的时间)
private
String
originalTime
;
//发布地址
private
String
sourceAddress
;
//摘要
private
String
summary
;
private
String
summaryRaw
;
//关键词
private
String
keyWords
;
//标题
private
String
title
;
private
String
titleRaw
;
//采集来源(如通用、定制、微信公众号等)
private
String
source
;
//附加字段
private
String
type
;
//标签信息
private
List
<
Label
>
labels
;
//视频下载链接
private
String
downLoadUrl
;
//视频链接(原链接 网页版)
private
String
videoUrl
;
//视频链接(原链接 手机版)
private
String
videoPhoneUrl
;
//视频时长
private
Long
videoTime
;
//视频第一帧图片
private
String
videoImg
;
//自定义标签
private
List
<
String
>
customLabel
;
private
Double
score
;
//专题库类型(0: 其它 1:政策;2:领导讲话;3:专家观点;4:企业案例)
private
Integer
classificationType
;
//置顶排位(默认为0)
private
Integer
topNum
;
//删除标记(1:删除;0:保留)
private
Integer
deleteFlag
;
private
String
subjectId
;
//审核操作(0:未审核 1:审核通过 2:审核未通过 3:暂定 默认值为0)
private
Integer
checkStatus
;
//阅读数
private
Long
readNum
=
0L
;
//是否收藏
private
boolean
ynCollect
=
false
;
//重复id
private
String
repeatId
;
//(1:主条目 0:非主条目)
private
String
flag
;
//关联的主条目id
private
String
masterEntryId
;
//原始id(去重服务生成的id,因为一条信息可以属于多个专题,原始id会发生改变,所以存储一个原始id,找寻对应关系)
private
String
originalId
;
//快照地址
private
String
screenShotImg
;
//资讯更新时间
private
String
updateDate
;
//信息类别(1:报刊 2:博客 3:客户端 4:论坛 5:视频 6:外媒 7:网站 8:微博 9:微信 10:新闻 11:政务 12:其它)
private
String
infoSourceType
;
//数据类型 qbyw:情报要闻 qbnc:情报内参
private
String
dataType
;
//abi报表地址
private
String
abiUrl
;
//abi报表id
private
String
abiId
;
//栏目code列表
private
List
<
String
>
programaIds
;
//数据库code列表
private
List
<
String
>
databaseIds
;
//是否风险
private
Integer
isRisk
;
//风险类型
private
List
<
String
>
riskTypes
;
//资讯关联的附件id
private
List
<
String
>
attachmentIds
;
//附件集合
private
List
<
AttachmentInfo
>
AttachmentInfos
;
//数据入专题库时间
private
String
processDate
;
//点赞数字
private
Integer
likesNum
=
0
;
//法规号
private
String
contentNo
;
//所属单位
private
String
socialCreditCode
;
/**
* 是否是主条目,0为非主条目,1为主条目
*/
private
Integer
ismain
;
//数据所在的索引名称
private
String
index
;
//股票代码
private
String
stockCode
=
""
;
//股票名称
private
String
stockName
=
""
;
//是否为共享数据:(0否 1是)
private
String
isShare
;
//副标题
private
String
subtitle
;
//昆仑研究成果数据中字段
private
String
fileExtra
;
//兑换状态:orderStatus(0未兑换 1已兑换)
private
String
orderStatus
;
//可信存证id
private
String
evidenceId
;
//数据hash
private
String
dataHash
;
//交易ID, 64位哈希值
private
String
txId
;
//可信存证保全函(证书)地址
private
String
evidenceFilePath
;
//数据所属用户id
private
String
userId
;
}
src/main/java/com/zzsn/thinktank/service/LeaderCategoryService.java
浏览文件 @
26950382
...
@@ -32,6 +32,8 @@ public interface LeaderCategoryService extends IService<ThinktankCategoryStructu
...
@@ -32,6 +32,8 @@ public interface LeaderCategoryService extends IService<ThinktankCategoryStructu
Result
<?>
lists
();
Result
<?>
lists
();
Result
<?>
listTop10
(
Integer
num
);
Result
<?>
getByName
(
String
category
,
String
typeName
);
Result
<?>
getByName
(
String
category
,
String
typeName
);
Result
<?>
getAll
(
String
category
);
Result
<?>
getAll
(
String
category
);
...
...
src/main/java/com/zzsn/thinktank/service/impl/LeaderCategoryServiceImpl.java
浏览文件 @
26950382
...
@@ -3,22 +3,39 @@ package com.zzsn.thinktank.service.impl;
...
@@ -3,22 +3,39 @@ package com.zzsn.thinktank.service.impl;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
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.zzsn.thinktank.entity.PolicySpecialInformation
;
import
com.zzsn.thinktank.entity.ThinktankBasicInfo
;
import
com.zzsn.thinktank.entity.ThinktankCategoryStructure
;
import
com.zzsn.thinktank.entity.ThinktankCategoryStructure
;
import
com.zzsn.thinktank.mapper.LeaderCategoryMapper
;
import
com.zzsn.thinktank.mapper.LeaderCategoryMapper
;
import
com.zzsn.thinktank.service.LeaderCategoryService
;
import
com.zzsn.thinktank.service.LeaderCategoryService
;
import
com.zzsn.thinktank.vo.CharacterCategoryStructureTreeVo
;
import
com.zzsn.thinktank.service.ThinktankBasicInfoService
;
import
com.zzsn.thinktank.vo.Result
;
import
com.zzsn.thinktank.util.EsUtil
;
import
com.zzsn.thinktank.vo.ThinktankCategoryStructureVo
;
import
com.zzsn.thinktank.util.SimRedisUtil
;
import
com.zzsn.thinktank.vo.*
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.lucene.search.join.ScoreMode
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.index.query.*
;
import
org.elasticsearch.search.SearchHit
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/**
/**
...
@@ -31,7 +48,14 @@ import java.util.stream.Collectors;
...
@@ -31,7 +48,14 @@ import java.util.stream.Collectors;
*/
*/
@Service
@Service
public
class
LeaderCategoryServiceImpl
extends
ServiceImpl
<
LeaderCategoryMapper
,
ThinktankCategoryStructure
>
implements
LeaderCategoryService
{
public
class
LeaderCategoryServiceImpl
extends
ServiceImpl
<
LeaderCategoryMapper
,
ThinktankCategoryStructure
>
implements
LeaderCategoryService
{
@Autowired
@Qualifier
(
"elasticsearch1Client"
)
RestHighLevelClient
client
;
@Autowired
ThinktankBasicInfoService
thinktankBasicInfoService
;
@Resource
private
SimRedisUtil
simRedisUtil
;
private
final
static
String
KEY
=
"thinkTank:listTop10"
;
@Override
@Override
@Transactional
@Transactional
public
Result
<?>
add
(
ThinktankCategoryStructure
characterCategoryStructure
)
{
public
Result
<?>
add
(
ThinktankCategoryStructure
characterCategoryStructure
)
{
...
@@ -167,6 +191,108 @@ public class LeaderCategoryServiceImpl extends ServiceImpl<LeaderCategoryMapper,
...
@@ -167,6 +191,108 @@ public class LeaderCategoryServiceImpl extends ServiceImpl<LeaderCategoryMapper,
}
}
@Override
@Override
public
Result
<?>
listTop10
(
Integer
num
)
{
List
<
ThinktankCategoryStructureVo
>
cacheObject
=
(
List
<
ThinktankCategoryStructureVo
>)
simRedisUtil
.
getCacheObject
(
KEY
);
if
(
cacheObject
!=
null
){
return
Result
.
OK
(
cacheObject
);
}
List
<
ThinktankCategoryStructureVo
>
listRes
=
new
ArrayList
<>();
List
<
String
>
listStr
=
new
ArrayList
<>();
listStr
.
add
(
"1537739653432397825"
);
listStr
.
add
(
"1537739804779663362"
);
listStr
.
add
(
"1537739894227390465"
);
listStr
.
add
(
"1539190285641097217"
);
try
{
BoolQueryBuilder
builder
=
QueryBuilders
.
boolQuery
();
builder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"deleteFlag"
,
0
));
builder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"checkStatus"
,
1
));
BoolQueryBuilder
builderQuery
=
QueryBuilders
.
boolQuery
();
for
(
String
subjectId
:
listStr
){
builderQuery
.
should
(
QueryBuilders
.
matchPhraseQuery
(
"subjectId"
,
subjectId
));
}
builder
.
must
(
builderQuery
);
BoolQueryBuilder
nestedBoolQueryBuilder
=
QueryBuilders
.
boolQuery
();
nestedBoolQueryBuilder
.
filter
(
QueryBuilders
.
matchPhraseQuery
(
"labels.labelMark"
,
"ThinkTanks"
));
QueryBuilder
nestedQueryBuilder
=
QueryBuilders
.
nestedQuery
(
"labels"
,
nestedBoolQueryBuilder
,
ScoreMode
.
None
);
builder
.
must
(
nestedQueryBuilder
);
SearchSourceBuilder
searchSourceBuilder
=
new
SearchSourceBuilder
();
searchSourceBuilder
.
from
(
0
);
searchSourceBuilder
.
size
(
99999
);
searchSourceBuilder
.
query
(
builder
);
String
[]
fetchFields
=
{
"id"
,
"labels"
};
searchSourceBuilder
.
fetchSource
(
fetchFields
,
null
);
//默认最大数量是10000,设置为true后,显示准确数量
searchSourceBuilder
.
trackTotalHits
(
true
);
SearchRequest
searchRequest
=
new
SearchRequest
(
"subjectdatabase"
);
searchRequest
.
source
(
searchSourceBuilder
);
//设置查询请求
//执行查询
SearchResponse
searchResponse
=
client
.
search
(
searchRequest
,
RequestOptions
.
DEFAULT
);
List
<
PolicySpecialInformation
>
list
=
new
ArrayList
<>();
for
(
SearchHit
documentFields
:
searchResponse
.
getHits
().
getHits
())
{
String
queryInfo
=
documentFields
.
getSourceAsString
();
PolicySpecialInformation
info
=
JSON
.
parseObject
(
queryInfo
,
PolicySpecialInformation
.
class
);
list
.
add
(
info
);
}
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
Map
<
String
,
Integer
>
countMap
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
PolicySpecialInformation
policySpecialInformation
=
list
.
get
(
i
);
List
<
Label
>
Labels
=
policySpecialInformation
.
getLabels
();
for
(
Label
label:
Labels
){
if
(
label
.
getLabelMark
().
equals
(
"ThinkTanks"
)){
if
(
countMap
.
containsKey
(
label
.
getRelationName
()))
{
Integer
count
=
countMap
.
get
(
label
.
getRelationName
());
countMap
.
put
(
label
.
getRelationName
(),
count
+
1
);
}
else
{
countMap
.
put
(
label
.
getRelationName
(),
1
);
}
}
}
}
Set
<
String
>
keySet
=
countMap
.
keySet
();
for
(
String
keyAsString
:
keySet
)
{
Integer
count
=
countMap
.
get
(
keyAsString
);
ThinktankCategoryStructureVo
vo
=
new
ThinktankCategoryStructureVo
();
QueryWrapper
query
=
new
QueryWrapper
();
query
.
eq
(
"chinese_whole"
,
keyAsString
);
List
<
ThinktankBasicInfo
>
listThink
=
thinktankBasicInfoService
.
list
(
query
);
if
(
listThink
.
size
()>
0
){
vo
.
setId
(
listThink
.
get
(
0
).
getBelongCountryId
());
vo
.
setTypeName
(
listThink
.
get
(
0
).
getBelongCountry
());
vo
.
setThinktankCount
(
count
);
listRes
.
add
(
vo
);
}
}
}
Map
<
String
,
ThinktankCategoryStructureVo
>
map
=
new
HashMap
<>();
for
(
ThinktankCategoryStructureVo
item
:
listRes
)
{
ThinktankCategoryStructureVo
existing
=
map
.
get
(
item
.
getId
());
if
(
existing
==
null
)
{
map
.
put
(
item
.
getId
(),
item
);
}
else
{
existing
.
setThinktankCount
(
existing
.
getThinktankCount
()
+
item
.
getThinktankCount
());
}
}
List
<
ThinktankCategoryStructureVo
>
mergedList
=
new
ArrayList
<>(
map
.
values
());
// 按照count降序排序,并只取前十条记录
List
<
ThinktankCategoryStructureVo
>
sortedAndLimitedList
=
mergedList
.
stream
()
.
sorted
(
Comparator
.
comparingInt
(
ThinktankCategoryStructureVo:
:
getThinktankCount
).
reversed
())
.
limit
(
10
)
.
collect
(
Collectors
.
toList
());
simRedisUtil
.
setCacheObject
(
KEY
,
sortedAndLimitedList
,
30L
,
TimeUnit
.
DAYS
);
return
Result
.
OK
(
sortedAndLimitedList
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取发布机构聚合结果异常{}"
,
e
);
}
return
Result
.
OK
(
listRes
);
}
@Override
public
Result
<?>
getByName
(
String
category
,
String
typeName
)
{
public
Result
<?>
getByName
(
String
category
,
String
typeName
)
{
//根据名称模糊查询
//根据名称模糊查询
List
<
ThinktankCategoryStructure
>
characterCategoryStructure
=
super
.
list
(
Wrappers
.<
ThinktankCategoryStructure
>
lambdaQuery
()
List
<
ThinktankCategoryStructure
>
characterCategoryStructure
=
super
.
list
(
Wrappers
.<
ThinktankCategoryStructure
>
lambdaQuery
()
...
...
src/main/java/com/zzsn/thinktank/util/SimRedisUtil.java
0 → 100644
浏览文件 @
26950382
package
com
.
zzsn
.
thinktank
.
util
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.BoundSetOperations
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* @author kongliufeng
* @Description TODO:
* @create 2021-03-23 20:38
* @Version 1.0
*/
@Component
public
class
SimRedisUtil
{
@Autowired
public
RedisTemplate
redisTemplate
;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
);
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @param timeout 时间
* @param timeUnit 时间颗粒度
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Long
timeout
,
final
TimeUnit
timeUnit
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
)
{
return
expire
(
key
,
timeout
,
TimeUnit
.
SECONDS
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @param unit 时间单位
* @return true=设置成功;false=设置失败
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
,
final
TimeUnit
unit
)
{
return
redisTemplate
.
expire
(
key
,
timeout
,
unit
);
}
/**
* 获得缓存的基本对象。
*
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public
<
T
>
T
getCacheObject
(
final
String
key
)
{
ValueOperations
<
String
,
T
>
operation
=
redisTemplate
.
opsForValue
();
return
operation
.
get
(
key
);
}
/**
* 删除单个对象
*
* @param key
*/
public
boolean
deleteObject
(
final
String
key
)
{
return
redisTemplate
.
delete
(
key
);
}
/**
* 删除集合对象
*
* @param collection 多个对象
* @return
*/
public
long
deleteObject
(
final
Collection
collection
)
{
return
redisTemplate
.
delete
(
collection
);
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public
<
T
>
long
setCacheListRight
(
final
String
key
,
final
List
<
T
>
dataList
)
{
Long
count
=
redisTemplate
.
opsForList
().
rightPushAll
(
key
,
dataList
);
return
count
==
null
?
0
:
count
;
}
public
<
T
>
long
setCacheListLeft
(
final
String
key
,
final
List
<
T
>
dataList
)
{
Long
count
=
redisTemplate
.
opsForList
().
leftPushAll
(
key
,
dataList
);
return
count
==
null
?
0
:
count
;
}
public
<
T
>
long
setCacheListLeftOne
(
final
String
key
,
final
T
dataList
)
{
Long
count
=
redisTemplate
.
opsForList
().
leftPush
(
key
,
dataList
);
return
count
==
null
?
0
:
count
;
}
/**
* 获得缓存的list对象
*
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public
<
T
>
List
<
T
>
getCacheList
(
final
String
key
)
{
return
redisTemplate
.
opsForList
().
range
(
key
,
0
,
-
1
);
}
public
<
T
>
List
<
T
>
getCacheList
(
final
String
key
,
long
start
,
long
end
){
return
redisTemplate
.
opsForList
().
range
(
key
,
start
,
end
);
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public
<
T
>
BoundSetOperations
<
String
,
T
>
setCacheSet
(
final
String
key
,
final
Set
<
T
>
dataSet
)
{
BoundSetOperations
<
String
,
T
>
setOperation
=
redisTemplate
.
boundSetOps
(
key
);
Iterator
<
T
>
it
=
dataSet
.
iterator
();
while
(
it
.
hasNext
())
{
setOperation
.
add
(
it
.
next
());
}
return
setOperation
;
}
/**
* 获得缓存的set
*
* @param key
* @return
*/
public
<
T
>
Set
<
T
>
getCacheSet
(
final
String
key
)
{
return
redisTemplate
.
opsForSet
().
members
(
key
);
}
/**
* 缓存Map
*
* @param key
* @param dataMap
*/
public
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
{
if
(
dataMap
!=
null
)
{
redisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
}
}
/**
* 获得缓存的Map
*
* @param key
* @return
*/
public
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
{
return
redisTemplate
.
opsForHash
().
entries
(
key
);
}
/**
* 往Hash中存入数据
*
* @param key Redis键
* @param hKey Hash键
* @param value 值
*/
public
<
T
>
void
setCacheMapValue
(
final
String
key
,
final
String
hKey
,
final
T
value
)
{
redisTemplate
.
opsForHash
().
put
(
key
,
hKey
,
value
);
}
/**
* 获取Hash中的数据
*
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public
<
T
>
T
getCacheMapValue
(
final
String
key
,
final
String
hKey
)
{
HashOperations
<
String
,
String
,
T
>
opsForHash
=
redisTemplate
.
opsForHash
();
return
opsForHash
.
get
(
key
,
hKey
);
}
/**
* 获取多个Hash中的数据
*
* @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
public
<
T
>
List
<
T
>
getMultiCacheMapValue
(
final
String
key
,
final
Collection
<
Object
>
hKeys
)
{
return
redisTemplate
.
opsForHash
().
multiGet
(
key
,
hKeys
);
}
/**
* 获得缓存的基本对象列表
*
* @param pattern 字符串前缀
* @return 对象列表
*/
public
Collection
<
String
>
keys
(
final
String
pattern
)
{
return
redisTemplate
.
keys
(
pattern
);
}
}
src/main/java/com/zzsn/thinktank/vo/InformationSourceVO.java
0 → 100644
浏览文件 @
26950382
package
com
.
zzsn
.
thinktank
.
vo
;
import
lombok.Data
;
/**
* 资讯来源统计VO
* @author yhj
* @date 2024/06/06/14:29
*/
@Data
public
class
InformationSourceVO
{
/**
* 来源
*/
private
String
source
;
/**
* 年月
*/
private
String
yearMonth
;
/**
* 数量
*/
private
int
count
;
public
InformationSourceVO
()
{
}
public
InformationSourceVO
(
String
source
,
String
yearMonth
,
int
count
)
{
this
.
source
=
source
;
this
.
yearMonth
=
yearMonth
;
this
.
count
=
count
;
}
}
src/main/java/com/zzsn/thinktank/vo/ThinktankCategoryStructureVo.java
浏览文件 @
26950382
...
@@ -7,6 +7,7 @@ import lombok.Data;
...
@@ -7,6 +7,7 @@ import lombok.Data;
import
lombok.EqualsAndHashCode
;
import
lombok.EqualsAndHashCode
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
...
@@ -18,7 +19,7 @@ import java.util.Date;
...
@@ -18,7 +19,7 @@ import java.util.Date;
*/
*/
@Data
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@EqualsAndHashCode
(
callSuper
=
false
)
public
class
ThinktankCategoryStructureVo
public
class
ThinktankCategoryStructureVo
implements
Serializable
{
{
/**
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论