Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
think-tank
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
张京坤
think-tank
Commits
d9c4d7ef
提交
d9c4d7ef
authored
10月 10, 2025
作者:
925993793@qq.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
本地处理智库和信息源的绑定关系
上级
9918e8dc
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
303 行增加
和
0 行删除
+303
-0
InfoSourceMain.java
src/main/java/com/zzsn/thinktank/entity/InfoSourceMain.java
+156
-0
InfoSourceMainMapper.java
.../java/com/zzsn/thinktank/mapper/InfoSourceMainMapper.java
+18
-0
InfoSourceMainService.java
...ava/com/zzsn/thinktank/service/InfoSourceMainService.java
+16
-0
InfoSourceMainServiceImpl.java
...zsn/thinktank/service/impl/InfoSourceMainServiceImpl.java
+23
-0
ThinkTankApplicationTests.java
...st/java/com/zzsn/thinktank/ThinkTankApplicationTests.java
+90
-0
没有找到文件。
src/main/java/com/zzsn/thinktank/entity/InfoSourceMain.java
0 → 100644
浏览文件 @
d9c4d7ef
package
com
.
zzsn
.
thinktank
.
entity
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
java.util.Date
;
import
java.io.Serializable
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 信息源表
* </p>
*
* @author obcy
* @since 2025-06-19
*/
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@TableName
(
"info_source_main"
)
public
class
InfoSourceMain
extends
Model
<
InfoSourceMain
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键
*/
@TableId
(
value
=
"id"
,
type
=
IdType
.
ASSIGN_ID
)
private
String
id
;
/**
* 信息源编码
*/
@TableField
(
"code"
)
private
String
code
;
/**
* 信息源名称
*/
@TableField
(
"info_name"
)
private
String
infoName
;
/**
* 类型
*/
@TableField
(
"type"
)
private
Integer
type
;
/**
* 地址
*/
@TableField
(
"info_address"
)
private
String
infoAddress
;
/**
* 别名
*/
@TableField
(
"alias"
)
private
String
alias
;
/**
* 是否原创性校验1 校验 0否
*/
@TableField
(
"original_check"
)
private
Integer
originalCheck
;
/**
* 校验列表
*/
@TableField
(
"check_list"
)
private
String
checkList
;
/**
* 主办单位
*/
@TableField
(
"organizer"
)
private
String
organizer
;
/**
* 地区全路径
*/
@TableField
(
"area_full_paths"
)
private
String
areaFullPaths
;
/**
* 地区名称
*/
@TableField
(
"area"
)
private
String
area
;
/**
* 是否翻墙
*/
@TableField
(
"skip_wall"
)
private
Integer
skipWall
;
/**
* 网站刷新速度
*/
@TableField
(
"refresh_speed"
)
private
Integer
refreshSpeed
;
/**
* 创建时间
*/
@TableField
(
"create_time"
)
private
Date
createTime
;
/**
* 更新时间
*/
@TableField
(
"update_time"
)
private
Date
updateTime
;
/**
* 创建人
*/
@TableField
(
"create_by"
)
private
String
createBy
;
/**
* 更新人
*/
@TableField
(
"update_by"
)
private
String
updateBy
;
@TableField
(
"del_flag"
)
@TableLogic
private
Integer
delFlag
;
/**是否免过关键词 0否 1是*/
@TableField
(
exist
=
false
)
private
Integer
isExemptKeyword
;
/**是否免审核 0否 1是*/
@TableField
(
exist
=
false
)
private
Integer
isFreeCheck
;
/**专题绑定的信息源的类型,定向或者非定向*/
@TableField
(
exist
=
false
)
private
String
subjectInfoSourceType
;
/**
* 信息源类别
*/
@TableField
(
exist
=
false
)
private
Integer
sourceType
;
/**
* 专题绑定信息源的主键id
*/
@TableField
(
exist
=
false
)
private
String
subjectInfoSourceId
;
@Override
protected
Serializable
pkVal
()
{
return
this
.
id
;
}
}
src/main/java/com/zzsn/thinktank/mapper/InfoSourceMainMapper.java
0 → 100644
浏览文件 @
d9c4d7ef
package
com
.
zzsn
.
thinktank
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zzsn.thinktank.entity.InfoSourceMain
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* <p>
* 信息源表 Mapper 接口
* </p>
*
* @author obcy
* @since 2025-06-19
*/
@Mapper
public
interface
InfoSourceMainMapper
extends
BaseMapper
<
InfoSourceMain
>
{
}
src/main/java/com/zzsn/thinktank/service/InfoSourceMainService.java
0 → 100644
浏览文件 @
d9c4d7ef
package
com
.
zzsn
.
thinktank
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.zzsn.thinktank.entity.InfoSourceMain
;
/**
* <p>
* 信息源表 服务类
* </p>
*
* @author obcy
* @since 2025-06-19
*/
public
interface
InfoSourceMainService
extends
IService
<
InfoSourceMain
>
{
}
src/main/java/com/zzsn/thinktank/service/impl/InfoSourceMainServiceImpl.java
0 → 100644
浏览文件 @
d9c4d7ef
package
com
.
zzsn
.
thinktank
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.zzsn.thinktank.entity.InfoSourceMain
;
import
com.zzsn.thinktank.mapper.InfoSourceMainMapper
;
import
com.zzsn.thinktank.service.InfoSourceMainService
;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
/**
* <p>
* 信息源表 服务实现类
* </p>
*
* @author obcy
* @since 2025-06-19
*/
@Service
public
class
InfoSourceMainServiceImpl
extends
ServiceImpl
<
InfoSourceMainMapper
,
InfoSourceMain
>
implements
InfoSourceMainService
{
}
src/test/java/com/zzsn/thinktank/ThinkTankApplicationTests.java
浏览文件 @
d9c4d7ef
package
com
.
zzsn
.
thinktank
;
import
cn.hutool.poi.excel.ExcelReader
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.zzsn.thinktank.entity.InfoSourceGroupMap
;
import
com.zzsn.thinktank.entity.InfoSourceMain
;
import
com.zzsn.thinktank.entity.ThinktankBasicInfo
;
import
com.zzsn.thinktank.service.*
;
import
com.zzsn.thinktank.vo.DataChangeVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
javax.annotation.Resource
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Slf4j
@SpringBootTest
class
ThinkTankApplicationTests
{
@Autowired
private
ThinktankBasicInfoService
thinktankBasicInfoService
;
@Resource
private
DataImportService
dataImportService
;
@Test
void
contextLoads
()
{
List
<
DataChangeVO
>
influencePositionList
=
dataImportService
.
dictItemList
(
"Influence"
);
Map
<
String
,
String
>
influencePositionMap
=
influencePositionList
.
stream
().
collect
(
Collectors
.
toMap
(
DataChangeVO:
:
getDescription
,
DataChangeVO:
:
getValue
,
(
value1
,
value2
)
->
value1
));
LambdaQueryWrapper
<
ThinktankBasicInfo
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
queryWrapper
.
select
(
ThinktankBasicInfo:
:
getId
,
ThinktankBasicInfo:
:
getInfluencePosition
);
List
<
ThinktankBasicInfo
>
list
=
thinktankBasicInfoService
.
list
(
queryWrapper
);
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
ThinktankBasicInfo
thinktankBasicInfo
=
list
.
get
(
i
);
String
influencePosition
=
thinktankBasicInfo
.
getInfluencePosition
();
if
(
influencePosition
!=
null
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
String
s
:
influencePosition
.
split
(
","
))
{
String
value
=
influencePositionMap
.
get
(
s
);
sb
.
append
(
","
).
append
(
value
);
}
thinktankBasicInfo
.
setInfluencePosition
(
sb
.
substring
(
1
));
}
log
.
info
(
"共-{},第-{}个,更新完成"
,
list
.
size
(),
i
+
1
);
}
thinktankBasicInfoService
.
updateBatchById
(
list
);
System
.
out
.
println
(
"结束"
);
}
@Autowired
private
InfoSourceGroupMapService
infoSourceGroupMapService
;
@Autowired
private
InfoSourceMainService
infoSourceMainService
;
@Test
public
void
handlerBindData
()
{
ExcelReader
reader
=
ExcelUtil
.
getReader
(
"C:\\Users\\lenovo\\Desktop\\202509智库优化信息源绑定.xlsx"
,
0
);
List
<
List
<
Object
>>
read
=
reader
.
read
(
1
,
296
);
for
(
List
<
Object
>
objects
:
read
)
{
String
code
=
objects
.
get
(
0
).
toString
();
String
infoSourceCode
=
objects
.
get
(
6
).
toString
();
if
(
StringUtils
.
isNotEmpty
(
code
)
&&
StringUtils
.
isNotEmpty
(
infoSourceCode
))
{
LambdaQueryWrapper
<
ThinktankBasicInfo
>
wrapper
=
Wrappers
.
lambdaQuery
();
wrapper
.
eq
(
ThinktankBasicInfo:
:
getCodeId
,
code
);
ThinktankBasicInfo
one
=
thinktankBasicInfoService
.
getOne
(
wrapper
);
if
(
one
!=
null
)
{
LambdaQueryWrapper
<
InfoSourceMain
>
query
=
Wrappers
.
lambdaQuery
();
query
.
eq
(
InfoSourceMain:
:
getCode
,
infoSourceCode
);
InfoSourceMain
infoSourceMain
=
infoSourceMainService
.
getOne
(
query
);
if
(
infoSourceMain
!=
null
)
{
LambdaQueryWrapper
<
InfoSourceGroupMap
>
queryWrapper
=
Wrappers
.
lambdaQuery
();
String
infoSourceId
=
infoSourceMain
.
getId
();
queryWrapper
.
eq
(
InfoSourceGroupMap:
:
getGroupId
,
one
.
getId
()).
eq
(
InfoSourceGroupMap:
:
getSourceId
,
infoSourceId
);
int
count
=
infoSourceGroupMapService
.
count
(
queryWrapper
);
if
(
count
==
0
)
{
InfoSourceGroupMap
infoSourceGroupMap
=
new
InfoSourceGroupMap
();
infoSourceGroupMap
.
setGroupId
(
one
.
getId
());
infoSourceGroupMap
.
setSourceId
(
infoSourceId
);
infoSourceGroupMap
.
setType
(
31
);
infoSourceGroupMap
.
setCreateTime
(
new
Date
());
infoSourceGroupMapService
.
save
(
infoSourceGroupMap
);
}
log
.
info
(
"{},智库绑定信息源处理完毕"
,
one
.
getChineseWhole
());
}
else
{
log
.
info
(
"{},信息源未找到"
,
infoSourceCode
);
}
}
else
{
log
.
info
(
"{},智库未找到"
,
code
);
}
}
else
{
log
.
info
(
"数据为空"
);
}
//break;
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论