Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
E
excel-export-service
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
export-service
excel-export-service
Commits
e132fcf9
提交
e132fcf9
authored
10月 10, 2025
作者:
lixiaojuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
添加全球智库导出
上级
3857424d
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
95 行增加
和
0 行删除
+95
-0
ThinkTanKStrategy.java
...excelexportservice/exportStrategys/ThinkTanKStrategy.java
+70
-0
ThinkTanKFeign.java
...ava/com/zzsn/excelexportservice/feign/ThinkTanKFeign.java
+21
-0
application-local.yml
src/main/resources/application-local.yml
+2
-0
application-test.yml
src/main/resources/application-test.yml
+2
-0
没有找到文件。
src/main/java/com/zzsn/excelexportservice/exportStrategys/ThinkTanKStrategy.java
0 → 100644
浏览文件 @
e132fcf9
package
com
.
zzsn
.
excelexportservice
.
exportStrategys
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.zzsn.excelexportservice.dto.ExportDataResponse
;
import
com.zzsn.excelexportservice.dto.ExportReq
;
import
com.zzsn.excelexportservice.dto.RequestParamHelper
;
import
com.zzsn.excelexportservice.feign.ThinkTanKFeign
;
import
jakarta.annotation.PostConstruct
;
import
jakarta.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @Author: lxj
* @Date: 2025/10/10 15:21
*/
@Component
public
class
ThinkTanKStrategy
implements
ExportStrategy
{
@Autowired
private
ThinkTanKFeign
thinkTanKFeign
;
private
final
Map
<
String
,
TriFunction
<
HttpServletRequest
,
Map
<
String
,
Object
>,
ExportReq
,
ExportDataResponse
<?>>>
pathMapping
=
new
HashMap
<>();
@PostConstruct
public
void
init
()
{
// 通用接口导出
register
(
"/thinkTanK/api/basicinfo/queryStatisticalAnalysis/export/excel"
,
(
request
,
queryParams
,
exportReq
)
->
thinkTanKFeign
.
queryStatisticalAnalysisExport
(
RequestParamHelper
.
getStringParam
(
queryParams
,
"type"
)));
}
private
void
register
(
String
path
,
TriFunction
<
HttpServletRequest
,
Map
<
String
,
Object
>,
ExportReq
,
ExportDataResponse
<?>>
func
)
{
pathMapping
.
put
(
path
,
(
request
,
queryParams
,
exportReq
)
->
{
try
{
return
func
.
apply
(
request
,
queryParams
,
exportReq
);
}
catch
(
Exception
e
)
{
// Feign 调用异常或其他不可预期异常统一处理
return
new
ExportDataResponse
<>(
2
,
"调用 think-tank 接口失败:"
+
e
.
getMessage
(),
Collections
.
emptyList
(),
Collections
.
emptyList
());
}
});
}
@Override
public
String
getServiceName
()
{
return
"think-tank"
;
}
@Override
public
String
getApiPath
()
{
return
null
;
// 所有接口由本策略处理
}
@Override
public
ExportDataResponse
<?>
execute
(
HttpServletRequest
request
,
Map
<
String
,
Object
>
queryParams
,
ExportReq
exportReq
)
{
TriFunction
<
HttpServletRequest
,
Map
<
String
,
Object
>,
ExportReq
,
ExportDataResponse
<?>>
func
=
pathMapping
.
get
(
exportReq
.
getApiPath
());
if
(
func
==
null
)
{
return
new
ExportDataResponse
<>(
404
,
"未找到匹配的接口: "
+
exportReq
.
getApiPath
(),
Collections
.
emptyList
(),
Collections
.
emptyList
());
}
return
func
.
apply
(
request
,
queryParams
,
exportReq
);
}
}
src/main/java/com/zzsn/excelexportservice/feign/ThinkTanKFeign.java
0 → 100644
浏览文件 @
e132fcf9
package
com
.
zzsn
.
excelexportservice
.
feign
;
import
com.zzsn.excelexportservice.dto.ExportDataResponse
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
/**
* @Author: lxj
* @Date: 2025/10/10 15:19
*/
@FeignClient
(
name
=
"think-tank"
,
url
=
"${excel.export.services.think-tank.data-url}"
)
public
interface
ThinkTanKFeign
{
@GetMapping
(
"/thinkTanK/api/basicinfo/queryStatisticalAnalysis/export/excel"
)
ExportDataResponse
<?>
queryStatisticalAnalysisExport
(
@RequestParam
(
"type"
)
String
type
);
}
src/main/resources/application-local.yml
浏览文件 @
e132fcf9
...
...
@@ -22,6 +22,8 @@ excel:
data-url
:
http://server-1-95-77-159.ciglobal.cn:10089
service-column
:
data-url
:
http://server-1-95-77-159.ciglobal.cn:10089
think-tank
:
data-url
:
http://server-1-95-77-159.ciglobal.cn:10089
#
forest
:
connect-timeout
:
600000
# HTTP请求连接超时时间
...
...
src/main/resources/application-test.yml
浏览文件 @
e132fcf9
...
...
@@ -22,6 +22,8 @@ excel:
data-url
:
http://server-1-95-77-159.ciglobal.cn:10089
service-column
:
data-url
:
http://server-1-95-77-159.ciglobal.cn:10089
think-tank
:
data-url
:
http://server-1-95-77-159.ciglobal.cn:10089
#
forest
:
connect-timeout
:
600000
# HTTP请求连接超时时间
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论