Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wangxiaolu-link-report
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
sfa
wangxiaolu-link-report
Commits
c6b6f944
提交
c6b6f944
authored
12月 13, 2025
作者:
吕本才
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(report): 重构QuickBI报表嵌入ticket查询逻辑
上级
5219fadc
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
47 行增加
和
24 行删除
+47
-24
ExtraReportQuickbiEmbedController.java
...t/controller/query/ExtraReportQuickbiEmbedController.java
+8
-6
ExtraReportQuickbiEmbedDao.java
...om/link/report/domain/dao/ExtraReportQuickbiEmbedDao.java
+2
-1
ExtraReportQuickbiEmbedDaoImpl.java
...eport/domain/dao/impl/ExtraReportQuickbiEmbedDaoImpl.java
+7
-5
ExtraReportQuickbiEmbedWq.java
.../com/link/report/domain/wq/ExtraReportQuickbiEmbedWq.java
+14
-0
ExtraReportQuickbiEmbedVo.java
.../link/report/pojo/response/ExtraReportQuickbiEmbedVo.java
+0
-1
ExtraReportQuickbiEmbedService.java
.../report/service/query/ExtraReportQuickbiEmbedService.java
+1
-1
ExtraReportQuickbiEmbedServiceImpl.java
...ervice/query/impl/ExtraReportQuickbiEmbedServiceImpl.java
+15
-10
没有找到文件。
src/main/java/com/link/report/controller/query/ExtraReportQuickbiEmbedController.java
浏览文件 @
c6b6f944
...
@@ -8,6 +8,7 @@ import com.sfa.common.core.web.controller.BaseController;
...
@@ -8,6 +8,7 @@ import com.sfa.common.core.web.controller.BaseController;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.security.RolesAllowed
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -38,14 +39,15 @@ public class ExtraReportQuickbiEmbedController extends BaseController {
...
@@ -38,14 +39,15 @@ public class ExtraReportQuickbiEmbedController extends BaseController {
}
}
@GetMapping
(
"/{id}"
)
@GetMapping
(
"/{id}"
)
// @ApiOperation("根据ID查询QuickBI报表嵌入信息")
public
R
<
ExtraReportQuickbiEmbedVo
>
getById
(
@PathVariable
Long
id
)
{
ExtraReportQuickbiEmbedVo
vo
=
extraReportQuickbiEmbedService
.
getById
(
id
);
public
R
<
ExtraReportQuickbiEmbedVo
>
getById
(
@PathVariable
String
pageId
)
{
ExtraReportQuickbiEmbedVo
vo
=
extraReportQuickbiEmbedService
.
getByPageId
(
pageId
);
return
vo
!=
null
?
R
.
ok
(
vo
)
:
R
.
fail
(
"记录不存在"
);
return
vo
!=
null
?
R
.
ok
(
vo
)
:
R
.
fail
(
"记录不存在"
);
}
}
@GetMapping
(
"/page/{pageId}"
)
@GetMapping
(
"/page/{pageId}"
)
// @ApiOperation("根据pageId查询QuickBI报表嵌入信息"
)
@RolesAllowed
(
value
=
{
"ROLE_ADMIN"
,}
)
public
R
<
ExtraReportQuickbiEmbedVo
>
getByPageId
(
@PathVariable
String
pageId
)
{
public
R
<
ExtraReportQuickbiEmbedVo
>
getByPageId
(
@PathVariable
String
pageId
)
{
ExtraReportQuickbiEmbedVo
vo
=
extraReportQuickbiEmbedService
.
getByPageId
(
pageId
);
ExtraReportQuickbiEmbedVo
vo
=
extraReportQuickbiEmbedService
.
getByPageId
(
pageId
);
return
vo
!=
null
?
R
.
ok
(
vo
)
:
R
.
fail
(
"记录不存在"
);
return
vo
!=
null
?
R
.
ok
(
vo
)
:
R
.
fail
(
"记录不存在"
);
...
@@ -74,7 +76,7 @@ public class ExtraReportQuickbiEmbedController extends BaseController {
...
@@ -74,7 +76,7 @@ public class ExtraReportQuickbiEmbedController extends BaseController {
* @return accessTicket
* @return accessTicket
*/
*/
@GetMapping
(
"/accessTicket"
)
@GetMapping
(
"/accessTicket"
)
public
R
<
ExtraReportQuickbiEmbedVo
>
queryAccessTicket
(
Long
i
d
)
{
public
R
<
ExtraReportQuickbiEmbedVo
>
queryAccessTicket
(
String
pageI
d
)
{
return
R
.
ok
(
extraReportQuickbiEmbedService
.
queryAccessTicket
(
i
d
));
return
R
.
ok
(
extraReportQuickbiEmbedService
.
queryAccessTicket
(
pageI
d
));
}
}
}
}
src/main/java/com/link/report/domain/dao/ExtraReportQuickbiEmbedDao.java
浏览文件 @
c6b6f944
package
com
.
link
.
report
.
domain
.
dao
;
package
com
.
link
.
report
.
domain
.
dao
;
import
com.link.report.domain.entity.ExtraReportQuickbiEmbed
;
import
com.link.report.domain.entity.ExtraReportQuickbiEmbed
;
import
com.link.report.domain.wq.ExtraReportQuickbiEmbedWq
;
import
java.util.List
;
import
java.util.List
;
...
@@ -11,7 +12,7 @@ public interface ExtraReportQuickbiEmbedDao {
...
@@ -11,7 +12,7 @@ public interface ExtraReportQuickbiEmbedDao {
ExtraReportQuickbiEmbed
selectById
(
Long
id
);
ExtraReportQuickbiEmbed
selectById
(
Long
id
);
ExtraReportQuickbiEmbed
select
ByPageId
(
String
pageId
);
ExtraReportQuickbiEmbed
select
One
(
ExtraReportQuickbiEmbedWq
pageId
);
List
<
ExtraReportQuickbiEmbed
>
selectAll
();
List
<
ExtraReportQuickbiEmbed
>
selectAll
();
...
...
src/main/java/com/link/report/domain/dao/impl/ExtraReportQuickbiEmbedDaoImpl.java
浏览文件 @
c6b6f944
package
com
.
link
.
report
.
domain
.
dao
.
impl
;
package
com
.
link
.
report
.
domain
.
dao
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.link.report.domain.dao.ExtraReportQuickbiEmbedDao
;
import
com.link.report.domain.dao.ExtraReportQuickbiEmbedDao
;
import
com.link.report.domain.entity.ExtraReportQuickbiEmbed
;
import
com.link.report.domain.entity.ExtraReportQuickbiEmbed
;
import
com.link.report.domain.mapper.ExtraReportQuickbiEmbedMapper
;
import
com.link.report.domain.mapper.ExtraReportQuickbiEmbedMapper
;
import
com.link.report.domain.wq.ExtraReportQuickbiEmbedWq
;
import
org.springframework.stereotype.Repository
;
import
org.springframework.stereotype.Repository
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -55,13 +57,13 @@ public class ExtraReportQuickbiEmbedDaoImpl implements ExtraReportQuickbiEmbedDa
...
@@ -55,13 +57,13 @@ public class ExtraReportQuickbiEmbedDaoImpl implements ExtraReportQuickbiEmbedDa
/**
/**
* 根据pageId查询报表嵌入信息
* 根据pageId查询报表嵌入信息
*
*
* @param
pageId QuickBI报表唯一标识ID
* @param
extraReportQuickbiEmbedWq QuickBI报表嵌入查询参数
* @return 报表嵌入信息实体
* @return 报表嵌入信息实体
*/
*/
@Override
@Override
public
ExtraReportQuickbiEmbed
select
ByPageId
(
String
pageId
)
{
public
ExtraReportQuickbiEmbed
select
One
(
ExtraReportQuickbiEmbedWq
extraReportQuickbiEmbedWq
)
{
QueryWrapper
<
ExtraReportQuickbiEmbed
>
queryWrapper
=
new
QueryWrapper
<
>();
LambdaQueryWrapper
<
ExtraReportQuickbiEmbed
>
queryWrapper
=
new
LambdaQueryWrapper
<
ExtraReportQuickbiEmbed
>();
queryWrapper
.
eq
(
"page_id"
,
pageId
);
// 匹配数据库字段page_id
queryWrapper
.
eq
(
ObjectUtil
.
isNotEmpty
(
extraReportQuickbiEmbedWq
.
getPageId
()),
ExtraReportQuickbiEmbed:
:
getPageId
,
extraReportQuickbiEmbedWq
.
getPageId
());
return
extraReportQuickbiEmbedMapper
.
selectOne
(
queryWrapper
);
return
extraReportQuickbiEmbedMapper
.
selectOne
(
queryWrapper
);
}
}
...
...
src/main/java/com/link/report/domain/wq/ExtraReportQuickbiEmbedWq.java
0 → 100644
浏览文件 @
c6b6f944
package
com
.
link
.
report
.
domain
.
wq
;
import
lombok.Data
;
/**
* QuickBI报表嵌入信息
*/
@Data
public
class
ExtraReportQuickbiEmbedWq
{
private
String
pageId
;
private
Long
id
;
private
String
accessTicket
;
}
src/main/java/com/link/report/pojo/response/ExtraReportQuickbiEmbedVo.java
浏览文件 @
c6b6f944
...
@@ -71,7 +71,6 @@ public class ExtraReportQuickbiEmbedVo implements Serializable {
...
@@ -71,7 +71,6 @@ public class ExtraReportQuickbiEmbedVo implements Serializable {
public
static
ExtraReportQuickbiEmbedVo
convertEntityToVo
(
ExtraReportQuickbiEmbed
entity
)
{
public
static
ExtraReportQuickbiEmbedVo
convertEntityToVo
(
ExtraReportQuickbiEmbed
entity
)
{
ExtraReportQuickbiEmbedVo
vo
=
new
ExtraReportQuickbiEmbedVo
();
ExtraReportQuickbiEmbedVo
vo
=
new
ExtraReportQuickbiEmbedVo
();
// 设置属性值...
vo
.
setId
(
entity
.
getId
());
vo
.
setId
(
entity
.
getId
());
vo
.
setName
(
entity
.
getName
());
vo
.
setName
(
entity
.
getName
());
vo
.
setPreviewUrl
(
entity
.
getPreviewUrl
());
vo
.
setPreviewUrl
(
entity
.
getPreviewUrl
());
...
...
src/main/java/com/link/report/service/query/ExtraReportQuickbiEmbedService.java
浏览文件 @
c6b6f944
...
@@ -42,5 +42,5 @@ public interface ExtraReportQuickbiEmbedService extends IService<ExtraReportQuic
...
@@ -42,5 +42,5 @@ public interface ExtraReportQuickbiEmbedService extends IService<ExtraReportQuic
*/
*/
boolean
deleteById
(
Long
id
);
boolean
deleteById
(
Long
id
);
ExtraReportQuickbiEmbedVo
queryAccessTicket
(
Long
i
d
);
ExtraReportQuickbiEmbedVo
queryAccessTicket
(
String
pageI
d
);
}
}
src/main/java/com/link/report/service/query/impl/ExtraReportQuickbiEmbedServiceImpl.java
浏览文件 @
c6b6f944
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import
com.link.report.config.ExtraQuickBiConfig
;
import
com.link.report.config.ExtraQuickBiConfig
;
import
com.link.report.domain.dao.ExtraReportQuickbiEmbedDao
;
import
com.link.report.domain.dao.ExtraReportQuickbiEmbedDao
;
import
com.link.report.domain.entity.ExtraReportQuickbiEmbed
;
import
com.link.report.domain.entity.ExtraReportQuickbiEmbed
;
import
com.link.report.domain.wq.ExtraReportQuickbiEmbedWq
;
import
com.link.report.pojo.request.ExtraReportQuickbiEmbedBo
;
import
com.link.report.pojo.request.ExtraReportQuickbiEmbedBo
;
import
com.link.report.pojo.response.ExtraReportQuickbiEmbedVo
;
import
com.link.report.pojo.response.ExtraReportQuickbiEmbedVo
;
import
com.link.report.service.query.ExtraReportQuickbiEmbedService
;
import
com.link.report.service.query.ExtraReportQuickbiEmbedService
;
...
@@ -34,8 +35,8 @@ import java.util.stream.Collectors;
...
@@ -34,8 +35,8 @@ import java.util.stream.Collectors;
public
class
ExtraReportQuickbiEmbedServiceImpl
implements
ExtraReportQuickbiEmbedService
{
public
class
ExtraReportQuickbiEmbedServiceImpl
implements
ExtraReportQuickbiEmbedService
{
@Resource
@Resource
private
final
ExtraReportQuickbiEmbedDao
extraReportQuickbiEmbedDao
;
private
final
ExtraReportQuickbiEmbedDao
extraReportQuickbiEmbedDao
;
@Resource
@Resource
private
ExtraQuickBiConfig
extraQuickBiConfig
;
private
ExtraQuickBiConfig
extraQuickBiConfig
;
...
@@ -93,7 +94,9 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
...
@@ -93,7 +94,9 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
*/
*/
@Override
@Override
public
ExtraReportQuickbiEmbedVo
getByPageId
(
String
pageId
)
{
public
ExtraReportQuickbiEmbedVo
getByPageId
(
String
pageId
)
{
ExtraReportQuickbiEmbed
entity
=
extraReportQuickbiEmbedDao
.
selectByPageId
(
pageId
);
ExtraReportQuickbiEmbedWq
extraReportQuickbiEmbedWq
=
new
ExtraReportQuickbiEmbedWq
();
extraReportQuickbiEmbedWq
.
setPageId
(
pageId
);
ExtraReportQuickbiEmbed
entity
=
extraReportQuickbiEmbedDao
.
selectOne
(
extraReportQuickbiEmbedWq
);
return
entity
!=
null
?
ExtraReportQuickbiEmbedVo
.
convertEntityToVo
(
entity
)
:
null
;
return
entity
!=
null
?
ExtraReportQuickbiEmbedVo
.
convertEntityToVo
(
entity
)
:
null
;
}
}
...
@@ -124,11 +127,13 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
...
@@ -124,11 +127,13 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
}
}
@Override
@Override
public
ExtraReportQuickbiEmbedVo
queryAccessTicket
(
Long
i
d
)
{
public
ExtraReportQuickbiEmbedVo
queryAccessTicket
(
String
pageI
d
)
{
// 查询workId
// 查询workId
ExtraReportQuickbiEmbed
entity
=
extraReportQuickbiEmbedDao
.
selectById
(
id
);
ExtraReportQuickbiEmbedWq
wq
=
new
ExtraReportQuickbiEmbedWq
();
wq
.
setPageId
(
pageId
);
ExtraReportQuickbiEmbed
entity
=
extraReportQuickbiEmbedDao
.
selectOne
(
wq
);
if
(
entity
==
null
)
{
if
(
entity
==
null
)
{
log
.
error
(
"记录不存在,
id:{}"
,
i
d
);
log
.
error
(
"记录不存在,
pageId:{}"
,
pageI
d
);
throw
new
ServiceException
(
"记录不存在"
);
throw
new
ServiceException
(
"记录不存在"
);
}
}
String
workId
=
entity
.
getPageId
();
String
workId
=
entity
.
getPageId
();
...
@@ -145,6 +150,7 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
...
@@ -145,6 +150,7 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
/**
/**
* 检查accessTicket
* 检查accessTicket
* 缓存中不存在则从QuickBI获取accessTicket
* 缓存中不存在则从QuickBI获取accessTicket
*
* @param workId
* @param workId
* @return
* @return
*/
*/
...
@@ -167,7 +173,7 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
...
@@ -167,7 +173,7 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
body
);
String
code
=
jsonObject
.
getString
(
"code"
);
String
code
=
jsonObject
.
getString
(
"code"
);
if
(
ObjectUtil
.
isEmpty
(
code
)
||
!
code
.
equals
(
"0"
)){
if
(
ObjectUtil
.
isEmpty
(
code
)
||
!
code
.
equals
(
"0"
))
{
throw
new
ServiceException
(
"获取accessTicket失败"
);
throw
new
ServiceException
(
"获取accessTicket失败"
);
}
}
String
accessTicketNew
=
jsonObject
.
getJSONObject
(
"data"
).
getString
(
"accessTicket"
);
String
accessTicketNew
=
jsonObject
.
getJSONObject
(
"data"
).
getString
(
"accessTicket"
);
...
@@ -178,8 +184,8 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
...
@@ -178,8 +184,8 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
return
accessTicketNew
;
return
accessTicketNew
;
}
}
private
String
getRedisKey
(
String
workId
)
{
private
String
getRedisKey
(
String
workId
)
{
return
"extra:report:quickbi:accessTicket:"
+
workId
;
return
"extra:report:quickbi:accessTicket:"
+
workId
;
}
}
// 对象转换方法
// 对象转换方法
...
@@ -195,7 +201,6 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
...
@@ -195,7 +201,6 @@ public class ExtraReportQuickbiEmbedServiceImpl implements ExtraReportQuickbiEmb
}
}
@Override
@Override
public
boolean
saveBatch
(
Collection
<
ExtraReportQuickbiEmbed
>
entityList
,
int
batchSize
)
{
public
boolean
saveBatch
(
Collection
<
ExtraReportQuickbiEmbed
>
entityList
,
int
batchSize
)
{
return
false
;
return
false
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论