Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
17a3b79e
提交
17a3b79e
authored
11月 11, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 完善公共链接
上级
2f0f68b4
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
648 行增加
和
61 行删除
+648
-61
ShiroServiceImpl.java
.../java/io/dataease/auth/service/impl/ShiroServiceImpl.java
+2
-0
PanelLinkMapping.java
...c/main/java/io/dataease/base/domain/PanelLinkMapping.java
+14
-0
PanelLinkMappingExample.java
...java/io/dataease/base/domain/PanelLinkMappingExample.java
+331
-0
PanelLinkMappingMapper.java
.../java/io/dataease/base/mapper/PanelLinkMappingMapper.java
+31
-0
PanelLinkMappingMapper.xml
...n/java/io/dataease/base/mapper/PanelLinkMappingMapper.xml
+165
-0
IndexController.java
...src/main/java/io/dataease/controller/IndexController.java
+19
-4
LinkApi.java
...c/main/java/io/dataease/controller/panel/api/LinkApi.java
+3
-6
LinkServer.java
.../java/io/dataease/controller/panel/server/LinkServer.java
+10
-9
LinkValidateRequest.java
...se/controller/request/panel/link/LinkValidateRequest.java
+11
-0
PanelLinkService.java
...main/java/io/dataease/service/panel/PanelLinkService.java
+36
-25
V28__de1.5.sql
backend/src/main/resources/db/migration/V28__de1.5.sql
+14
-2
generatorConfig.xml
backend/src/main/resources/generatorConfig.xml
+1
-1
index.js
frontend/src/utils/index.js
+6
-1
index.vue
frontend/src/views/link/generate/index.vue
+4
-13
index.vue
frontend/src/views/link/index.vue
+1
-0
没有找到文件。
backend/src/main/java/io/dataease/auth/service/impl/ShiroServiceImpl.java
浏览文件 @
17a3b79e
...
...
@@ -41,6 +41,8 @@ public class ShiroServiceImpl implements ShiroService {
filterChainDefinitionMap
.
put
(
"/link/**"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/index.html"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/link.html"
,
ANON
);
filterChainDefinitionMap
.
put
(
"/xggznb/**"
,
ANON
);
//获取主题信息
filterChainDefinitionMap
.
put
(
"/plugin/theme/themes"
,
ANON
);
...
...
backend/src/main/java/io/dataease/base/domain/PanelLinkMapping.java
0 → 100644
浏览文件 @
17a3b79e
package
io
.
dataease
.
base
.
domain
;
import
java.io.Serializable
;
import
lombok.Data
;
@Data
public
class
PanelLinkMapping
implements
Serializable
{
private
Long
id
;
private
String
resourceId
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/domain/PanelLinkMappingExample.java
0 → 100644
浏览文件 @
17a3b79e
package
io
.
dataease
.
base
.
domain
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
PanelLinkMappingExample
{
protected
String
orderByClause
;
protected
boolean
distinct
;
protected
List
<
Criteria
>
oredCriteria
;
public
PanelLinkMappingExample
()
{
oredCriteria
=
new
ArrayList
<
Criteria
>();
}
public
void
setOrderByClause
(
String
orderByClause
)
{
this
.
orderByClause
=
orderByClause
;
}
public
String
getOrderByClause
()
{
return
orderByClause
;
}
public
void
setDistinct
(
boolean
distinct
)
{
this
.
distinct
=
distinct
;
}
public
boolean
isDistinct
()
{
return
distinct
;
}
public
List
<
Criteria
>
getOredCriteria
()
{
return
oredCriteria
;
}
public
void
or
(
Criteria
criteria
)
{
oredCriteria
.
add
(
criteria
);
}
public
Criteria
or
()
{
Criteria
criteria
=
createCriteriaInternal
();
oredCriteria
.
add
(
criteria
);
return
criteria
;
}
public
Criteria
createCriteria
()
{
Criteria
criteria
=
createCriteriaInternal
();
if
(
oredCriteria
.
size
()
==
0
)
{
oredCriteria
.
add
(
criteria
);
}
return
criteria
;
}
protected
Criteria
createCriteriaInternal
()
{
Criteria
criteria
=
new
Criteria
();
return
criteria
;
}
public
void
clear
()
{
oredCriteria
.
clear
();
orderByClause
=
null
;
distinct
=
false
;
}
protected
abstract
static
class
GeneratedCriteria
{
protected
List
<
Criterion
>
criteria
;
protected
GeneratedCriteria
()
{
super
();
criteria
=
new
ArrayList
<
Criterion
>();
}
public
boolean
isValid
()
{
return
criteria
.
size
()
>
0
;
}
public
List
<
Criterion
>
getAllCriteria
()
{
return
criteria
;
}
public
List
<
Criterion
>
getCriteria
()
{
return
criteria
;
}
protected
void
addCriterion
(
String
condition
)
{
if
(
condition
==
null
)
{
throw
new
RuntimeException
(
"Value for condition cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
));
}
protected
void
addCriterion
(
String
condition
,
Object
value
,
String
property
)
{
if
(
value
==
null
)
{
throw
new
RuntimeException
(
"Value for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value
));
}
protected
void
addCriterion
(
String
condition
,
Object
value1
,
Object
value2
,
String
property
)
{
if
(
value1
==
null
||
value2
==
null
)
{
throw
new
RuntimeException
(
"Between values for "
+
property
+
" cannot be null"
);
}
criteria
.
add
(
new
Criterion
(
condition
,
value1
,
value2
));
}
public
Criteria
andIdIsNull
()
{
addCriterion
(
"id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIsNotNull
()
{
addCriterion
(
"id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdEqualTo
(
Long
value
)
{
addCriterion
(
"id ="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotEqualTo
(
Long
value
)
{
addCriterion
(
"id <>"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThan
(
Long
value
)
{
addCriterion
(
"id >"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdGreaterThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id >="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThan
(
Long
value
)
{
addCriterion
(
"id <"
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdLessThanOrEqualTo
(
Long
value
)
{
addCriterion
(
"id <="
,
value
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotIn
(
List
<
Long
>
values
)
{
addCriterion
(
"id not in"
,
values
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andIdNotBetween
(
Long
value1
,
Long
value2
)
{
addCriterion
(
"id not between"
,
value1
,
value2
,
"id"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdIsNull
()
{
addCriterion
(
"resource_id is null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdIsNotNull
()
{
addCriterion
(
"resource_id is not null"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdEqualTo
(
String
value
)
{
addCriterion
(
"resource_id ="
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdNotEqualTo
(
String
value
)
{
addCriterion
(
"resource_id <>"
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdGreaterThan
(
String
value
)
{
addCriterion
(
"resource_id >"
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdGreaterThanOrEqualTo
(
String
value
)
{
addCriterion
(
"resource_id >="
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdLessThan
(
String
value
)
{
addCriterion
(
"resource_id <"
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdLessThanOrEqualTo
(
String
value
)
{
addCriterion
(
"resource_id <="
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdLike
(
String
value
)
{
addCriterion
(
"resource_id like"
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdNotLike
(
String
value
)
{
addCriterion
(
"resource_id not like"
,
value
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdIn
(
List
<
String
>
values
)
{
addCriterion
(
"resource_id in"
,
values
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdNotIn
(
List
<
String
>
values
)
{
addCriterion
(
"resource_id not in"
,
values
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"resource_id between"
,
value1
,
value2
,
"resourceId"
);
return
(
Criteria
)
this
;
}
public
Criteria
andResourceIdNotBetween
(
String
value1
,
String
value2
)
{
addCriterion
(
"resource_id not between"
,
value1
,
value2
,
"resourceId"
);
return
(
Criteria
)
this
;
}
}
public
static
class
Criteria
extends
GeneratedCriteria
{
protected
Criteria
()
{
super
();
}
}
public
static
class
Criterion
{
private
String
condition
;
private
Object
value
;
private
Object
secondValue
;
private
boolean
noValue
;
private
boolean
singleValue
;
private
boolean
betweenValue
;
private
boolean
listValue
;
private
String
typeHandler
;
public
String
getCondition
()
{
return
condition
;
}
public
Object
getValue
()
{
return
value
;
}
public
Object
getSecondValue
()
{
return
secondValue
;
}
public
boolean
isNoValue
()
{
return
noValue
;
}
public
boolean
isSingleValue
()
{
return
singleValue
;
}
public
boolean
isBetweenValue
()
{
return
betweenValue
;
}
public
boolean
isListValue
()
{
return
listValue
;
}
public
String
getTypeHandler
()
{
return
typeHandler
;
}
protected
Criterion
(
String
condition
)
{
super
();
this
.
condition
=
condition
;
this
.
typeHandler
=
null
;
this
.
noValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
typeHandler
=
typeHandler
;
if
(
value
instanceof
List
<?>)
{
this
.
listValue
=
true
;
}
else
{
this
.
singleValue
=
true
;
}
}
protected
Criterion
(
String
condition
,
Object
value
)
{
this
(
condition
,
value
,
null
);
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
,
String
typeHandler
)
{
super
();
this
.
condition
=
condition
;
this
.
value
=
value
;
this
.
secondValue
=
secondValue
;
this
.
typeHandler
=
typeHandler
;
this
.
betweenValue
=
true
;
}
protected
Criterion
(
String
condition
,
Object
value
,
Object
secondValue
)
{
this
(
condition
,
value
,
secondValue
,
null
);
}
}
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/PanelLinkMappingMapper.java
0 → 100644
浏览文件 @
17a3b79e
package
io
.
dataease
.
base
.
mapper
;
import
io.dataease.base.domain.PanelLinkMapping
;
import
io.dataease.base.domain.PanelLinkMappingExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
PanelLinkMappingMapper
{
long
countByExample
(
PanelLinkMappingExample
example
);
int
deleteByExample
(
PanelLinkMappingExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
PanelLinkMapping
record
);
int
insertSelective
(
PanelLinkMapping
record
);
List
<
PanelLinkMapping
>
selectByExample
(
PanelLinkMappingExample
example
);
PanelLinkMapping
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
PanelLinkMapping
record
,
@Param
(
"example"
)
PanelLinkMappingExample
example
);
int
updateByExample
(
@Param
(
"record"
)
PanelLinkMapping
record
,
@Param
(
"example"
)
PanelLinkMappingExample
example
);
int
updateByPrimaryKeySelective
(
PanelLinkMapping
record
);
int
updateByPrimaryKey
(
PanelLinkMapping
record
);
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/PanelLinkMappingMapper.xml
0 → 100644
浏览文件 @
17a3b79e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"io.dataease.base.mapper.PanelLinkMappingMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.base.domain.PanelLinkMapping"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"resource_id"
jdbcType=
"VARCHAR"
property=
"resourceId"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, resource_id
</sql>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.PanelLinkMappingExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from panel_link_mapping
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from panel_link_mapping
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from panel_link_mapping
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"io.dataease.base.domain.PanelLinkMappingExample"
>
delete from panel_link_mapping
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.PanelLinkMapping"
>
insert into panel_link_mapping (id, resource_id)
values (#{id,jdbcType=BIGINT}, #{resourceId,jdbcType=VARCHAR})
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.PanelLinkMapping"
>
insert into panel_link_mapping
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"resourceId != null"
>
resource_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"resourceId != null"
>
#{resourceId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"io.dataease.base.domain.PanelLinkMappingExample"
resultType=
"java.lang.Long"
>
select count(*) from panel_link_mapping
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update panel_link_mapping
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.resourceId != null"
>
resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update panel_link_mapping
set id = #{record.id,jdbcType=BIGINT},
resource_id = #{record.resourceId,jdbcType=VARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.dataease.base.domain.PanelLinkMapping"
>
update panel_link_mapping
<set>
<if
test=
"resourceId != null"
>
resource_id = #{resourceId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.dataease.base.domain.PanelLinkMapping"
>
update panel_link_mapping
set resource_id = #{resourceId,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/controller/IndexController.java
浏览文件 @
17a3b79e
...
...
@@ -2,11 +2,15 @@ package io.dataease.controller;
import
io.dataease.commons.license.DefaultLicenseService
;
import
io.dataease.commons.license.F2CLicenseResponse
;
import
io.dataease.commons.utils.ServletUtils
;
import
io.dataease.service.panel.PanelLinkService
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
javax.annotation.Resource
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletResponse
;
@Controller
@RequestMapping
...
...
@@ -15,6 +19,9 @@ public class IndexController {
@Resource
private
DefaultLicenseService
defaultLicenseService
;
@Resource
private
PanelLinkService
panelLinkService
;
@GetMapping
(
value
=
"/"
)
public
String
index
()
{
return
"index.html"
;
...
...
@@ -43,10 +50,18 @@ public class IndexController {
return
"doc.html"
;
default
:
// DataEaseException.throwException("Invalid License.");
/* return "nolic.html"; */
return
"doc.html"
;
return
"nolic.html"
;
}
// return "index.html";
}
@GetMapping
(
"/xggznb/{index}"
)
public
String
xggznb
(
@PathVariable
(
value
=
"index"
,
required
=
true
)
Long
index
)
{
String
url
=
panelLinkService
.
getUrlByIndex
(
index
);
HttpServletResponse
response
=
ServletUtils
.
response
();
String
param
=
url
.
substring
(
url
.
indexOf
(
"?"
)
+
1
);
Cookie
cookie
=
new
Cookie
(
"link"
,
param
);
response
.
addCookie
(
cookie
);
return
url
;
}
...
...
backend/src/main/java/io/dataease/controller/panel/api/LinkApi.java
浏览文件 @
17a3b79e
...
...
@@ -4,10 +4,7 @@ package io.dataease.controller.panel.api;
import
com.github.xiaoymin.knife4j.annotations.ApiSupport
;
import
io.dataease.controller.ResultHolder
;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.panel.link.EnablePwdRequest
;
import
io.dataease.controller.request.panel.link.LinkRequest
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.controller.request.panel.link.*
;
import
io.dataease.dto.panel.link.GenerateDto
;
import
io.dataease.dto.panel.link.ValidateDto
;
import
io.swagger.annotations.Api
;
...
...
@@ -44,7 +41,7 @@ public interface LinkApi {
@ApiOperation
(
"验证访问"
)
@PostMapping
(
"/validate"
)
ValidateDto
validate
(
Map
<
String
,
String
>
param
)
throws
Exception
;
ValidateDto
validate
(
LinkValidateRequest
request
)
throws
Exception
;
@ApiOperation
(
"验证密码"
)
@PostMapping
(
"/validatePwd"
)
...
...
@@ -60,5 +57,5 @@ public interface LinkApi {
@ApiOperation
(
"压缩链接"
)
@PostMapping
(
"/shortUrl"
)
ResultHolder
shortUrl
(
@RequestBody
Map
<
String
,
String
>
param
);
String
shortUrl
(
@RequestBody
Map
<
String
,
String
>
param
);
}
backend/src/main/java/io/dataease/controller/panel/server/LinkServer.java
浏览文件 @
17a3b79e
...
...
@@ -5,10 +5,7 @@ import io.dataease.base.domain.PanelLink;
import
io.dataease.controller.ResultHolder
;
import
io.dataease.controller.panel.api.LinkApi
;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.panel.link.EnablePwdRequest
;
import
io.dataease.controller.request.panel.link.LinkRequest
;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.controller.request.panel.link.*
;
import
io.dataease.dto.panel.link.GenerateDto
;
import
io.dataease.dto.panel.link.ValidateDto
;
import
io.dataease.service.chart.ChartViewService
;
...
...
@@ -64,12 +61,10 @@ public class LinkServer implements LinkApi {
}
@Override
public
ValidateDto
validate
(
@RequestBody
Map
<
String
,
String
>
param
)
throws
Exception
{
String
link
=
param
.
get
(
"link"
);
public
ValidateDto
validate
(
@RequestBody
LinkValidateRequest
request
)
throws
Exception
{
String
link
=
request
.
getLink
(
);
String
json
=
panelLinkService
.
decryptParam
(
link
);
/* Gson gson = new Gson();
ValidateRequest request = gson.fromJson(json, ValidateRequest.class); */
ValidateDto
dto
=
new
ValidateDto
();
String
resourceId
=
json
;
/* String resourceId = request.getResourceId(); */
...
...
@@ -101,9 +96,15 @@ public class LinkServer implements LinkApi {
return
chartViewService
.
getData
(
viewId
,
requestList
);
}
@Override
/*
@Override
public ResultHolder shortUrl(Map<String,String> param) {
String url = param.get("url");
return panelLinkService.getShortUrl(url);
}*/
@Override
public
String
shortUrl
(
Map
<
String
,
String
>
param
)
{
String
resourceId
=
param
.
get
(
"resourceId"
);
return
panelLinkService
.
getShortUrl
(
resourceId
);
}
}
backend/src/main/java/io/dataease/controller/request/panel/link/LinkValidateRequest.java
0 → 100644
浏览文件 @
17a3b79e
package
io
.
dataease
.
controller
.
request
.
panel
.
link
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
LinkValidateRequest
implements
Serializable
{
private
String
link
;
}
backend/src/main/java/io/dataease/service/panel/PanelLinkService.java
浏览文件 @
17a3b79e
...
...
@@ -7,8 +7,11 @@ import io.dataease.auth.util.JWTUtils;
import
io.dataease.auth.util.RsaUtil
;
import
io.dataease.base.domain.PanelGroupWithBLOBs
;
import
io.dataease.base.domain.PanelLink
;
import
io.dataease.base.domain.PanelLinkMapping
;
import
io.dataease.base.domain.PanelLinkMappingExample
;
import
io.dataease.base.mapper.PanelGroupMapper
;
import
io.dataease.base.mapper.PanelLinkMapper
;
import
io.dataease.base.mapper.PanelLinkMappingMapper
;
import
io.dataease.base.mapper.ext.ExtPanelLinkMapper
;
import
io.dataease.commons.utils.ServletUtils
;
import
io.dataease.controller.ResultHolder
;
...
...
@@ -17,29 +20,28 @@ import io.dataease.controller.request.panel.link.LinkRequest;
import
io.dataease.controller.request.panel.link.OverTimeRequest
;
import
io.dataease.controller.request.panel.link.PasswordRequest
;
import
io.dataease.dto.panel.link.GenerateDto
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
PanelLinkService
{
private
static
final
String
baseUrl
=
"/link.html?link="
;
private
static
final
String
BASEURL
=
"/link.html?link="
;
@Value
(
"${dataease.public-link-salt:DataEaseLinkSalt}"
)
private
String
salt
;
@Value
(
"${dataease.short-url-site:https://dh6.ink/}"
)
private
String
shortUrlSite
;
@Value
(
"${dataease.short-url-api:api/url/add}"
)
private
String
shortUrlApi
;
private
static
final
String
SHORT_URL_PREFIX
=
"/xggznb/"
;
@Resource
private
PanelLinkMapper
mapper
;
...
...
@@ -50,6 +52,9 @@ public class PanelLinkService {
@Resource
private
ExtPanelLinkMapper
extPanelLinkMapper
;
@Resource
private
PanelLinkMappingMapper
panelLinkMappingMapper
;
public
void
changeValid
(
LinkRequest
request
){
PanelLink
po
=
new
PanelLink
();
po
.
setResourceId
(
request
.
getResourceId
());
...
...
@@ -84,6 +89,7 @@ public class PanelLinkService {
return
panelLink
;
}
@Transactional
public
GenerateDto
currentGenerate
(
String
resourceId
)
{
PanelLink
one
=
findOne
(
resourceId
);
if
(
ObjectUtils
.
isEmpty
(
one
))
{
...
...
@@ -94,6 +100,16 @@ public class PanelLinkService {
one
.
setEnablePwd
(
false
);
mapper
.
insert
(
one
);
}
PanelLinkMappingExample
example
=
new
PanelLinkMappingExample
();
example
.
createCriteria
().
andResourceIdEqualTo
(
resourceId
);
List
<
PanelLinkMapping
>
mappings
=
panelLinkMappingMapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isEmpty
(
mappings
))
{
PanelLinkMapping
mapping
=
new
PanelLinkMapping
();
mapping
.
setResourceId
(
resourceId
);
panelLinkMappingMapper
.
insert
(
mapping
);
}
return
convertDto
(
one
);
}
...
...
@@ -136,7 +152,7 @@ public class PanelLinkService {
result
.
setValid
(
linl
.
getValid
());
result
.
setEnablePwd
(
linl
.
getEnablePwd
());
result
.
setPwd
(
linl
.
getPwd
());
result
.
setUri
(
baseUrl
+
buildLinkParam
(
linl
.
getResourceId
()));
result
.
setUri
(
BASEURL
+
buildLinkParam
(
linl
.
getResourceId
()));
result
.
setOverTime
(
linl
.
getOverTime
());
return
result
;
}
...
...
@@ -190,23 +206,18 @@ public class PanelLinkService {
}
public
ResultHolder
getShortUrl
(
String
url
)
{
Gson
gson
=
new
Gson
();
Map
param
=
new
HashMap
<>();
param
.
put
(
"diy"
,
false
);
param
.
put
(
"link"
,
url
);
param
.
put
(
"sort"
,
""
);
String
post
=
HttpUtil
.
post
(
shortUrlSite
+
shortUrlApi
,
param
);
try
{
Map
map
=
gson
.
fromJson
(
post
,
Map
.
class
);
Map
data
=
(
Map
)
map
.
get
(
"data"
);
String
sort
=
shortUrlSite
+
data
.
get
(
"sort"
).
toString
();
ResultHolder
success
=
ResultHolder
.
success
(
sort
);
return
success
;
}
catch
(
Exception
e
)
{
ResultHolder
error
=
ResultHolder
.
error
(
e
.
getMessage
());
return
error
;
}
public
String
getShortUrl
(
String
resourceId
)
{
PanelLinkMappingExample
example
=
new
PanelLinkMappingExample
();
example
.
createCriteria
().
andResourceIdEqualTo
(
resourceId
);
List
<
PanelLinkMapping
>
mappings
=
panelLinkMappingMapper
.
selectByExample
(
example
);
PanelLinkMapping
mapping
=
mappings
.
get
(
0
);
return
SHORT_URL_PREFIX
+
mapping
.
getId
();
}
public
String
getUrlByIndex
(
Long
index
)
{
PanelLinkMapping
mapping
=
panelLinkMappingMapper
.
selectByPrimaryKey
(
index
);
String
resourceId
=
mapping
.
getResourceId
();
PanelLink
one
=
findOne
(
resourceId
);
return
convertDto
(
one
).
getUri
();
}
}
backend/src/main/resources/db/migration/V28__de1.5.sql
浏览文件 @
17a3b79e
...
...
@@ -2,4 +2,17 @@
-- 新增我分享出去的功能
-- ----------------------------
ALTER
TABLE
`dataease`
.
`panel_share`
ADD
COLUMN
`granter`
varchar
(
255
)
NULL
COMMENT
'分享人'
AFTER
`target_id`
;
\ No newline at end of file
ADD
COLUMN
`granter`
varchar
(
255
)
NULL
COMMENT
'分享人'
AFTER
`target_id`
;
-- ----------------------------
-- Table structure for panel_link_mapping
-- ----------------------------
DROP
TABLE
IF
EXISTS
`panel_link_mapping`
;
CREATE
TABLE
`panel_link_mapping`
(
`id`
bigint
(
20
)
NOT
NULL
AUTO_INCREMENT
COMMENT
'id'
,
`resource_id`
varchar
(
255
)
DEFAULT
NULL
COMMENT
'仪表板ID'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
AUTO_INCREMENT
=
1
DEFAULT
CHARSET
=
utf8
;
backend/src/main/resources/generatorConfig.xml
浏览文件 @
17a3b79e
...
...
@@ -69,7 +69,7 @@
<!-- <table tableName="panel_link_jump_info"/>-->
<!-- <table tableName="panel_link_jump_target_view_info"/>-->
<table
tableName=
"v_auth_model"
/>
<table
tableName=
"panel_link_mapping"
/>
<!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>-->
<!-- <table tableName="v_chart">-->
...
...
frontend/src/utils/index.js
浏览文件 @
17a3b79e
import
Cookies
from
'js-cookie'
export
function
timeSection
(
date
,
type
)
{
if
(
!
date
)
{
return
null
...
...
@@ -265,7 +266,11 @@ export function formatQuickCondition(param, quickField) {
}
export
function
getQueryVariable
(
variable
)
{
const
query
=
window
.
location
.
search
.
substring
(
1
)
debugger
let
query
=
window
.
location
.
search
.
substring
(
1
)
if
(
!
query
)
{
query
=
Cookies
.
get
(
variable
)
}
const
vars
=
query
.
split
(
'&'
)
for
(
var
i
=
0
;
i
<
vars
.
length
;
i
++
)
{
const
pair
=
vars
[
i
].
split
(
'='
)
...
...
frontend/src/views/link/generate/index.vue
浏览文件 @
17a3b79e
...
...
@@ -46,8 +46,6 @@
<div
v-if=
"valid"
class=
"auth-root-class"
>
<span
slot=
"footer"
>
<el-button
v-if=
"newUrl && !form.enablePwd"
v-clipboard:copy=
"newUrl"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_short_link'
)
}}
</el-button>
<el-button
v-if=
"newUrl && form.enablePwd"
v-clipboard:copy=
"newUrl + ' Password: '+ form.pwd"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_short_link_passwd'
)
}}
</el-button>
<el-button
v-if=
"!form.enablePwd"
v-clipboard:copy=
"form.uri"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_link'
)
}}
</el-button>
<el-button
v-if=
"form.enablePwd"
v-clipboard:copy=
"form.uri + ' Password: '+ form.pwd"
v-clipboard:success=
"onCopy"
v-clipboard:error=
"onError"
size=
"mini"
type=
"primary"
>
{{
$t
(
'panel.copy_link_passwd'
)
}}
</el-button>
...
...
@@ -77,7 +75,6 @@ export default {
pwdNums
:
4
,
valid
:
false
,
form
:
{},
newUrl
:
null
,
defaultForm
:
{
enablePwd
:
false
,
pwd
:
null
,
uri
:
null
},
pickerOptions
:
{
disabledDate
:
time
=>
{
...
...
@@ -127,7 +124,7 @@ export default {
/* pwd && (this.form.pwd = decrypt(pwd)) */
/* overTime && (this.form.overTime = overTime) */
overTime
&&
(
this
.
$set
(
this
.
form
,
'overTime'
,
overTime
))
//
this.requestShort()
this
.
requestShort
()
})
},
...
...
@@ -176,11 +173,9 @@ export default {
},
onCopy
(
e
)
{
// alert('You just copied: ' + e.text)
this
.
$success
(
this
.
$t
(
'commons.copy_success'
))
},
onError
(
e
)
{
// alert('Failed to copy texts')
},
onChange
(
value
)
{
const
param
=
{
...
...
@@ -194,14 +189,10 @@ export default {
requestShort
()
{
const
url
=
this
.
form
.
uri
if
(
!
url
)
return
// if (this.origin.includes('localhost') || this.origin.includes('127.0.0.1')) {
// console.log('本地无法生成短链接')
// this.$warning('本地无法生成短链接')
// return
// }
shortUrl
({
url
}).
then
(
res
=>
{
shortUrl
({
resourceId
:
this
.
resourceId
}).
then
(
res
=>
{
if
(
res
.
success
)
{
this
.
newUrl
=
res
.
data
this
.
form
.
uri
=
this
.
origin
+
res
.
data
}
})
},
...
...
frontend/src/views/link/index.vue
浏览文件 @
17a3b79e
...
...
@@ -31,6 +31,7 @@ export default {
methods
:
{
loadInit
()
{
debugger
this
.
link
=
getQueryVariable
(
this
.
PARAMKEY
)
validate
({
link
:
this
.
link
}).
then
(
res
=>
{
const
{
resourceId
,
valid
,
enablePwd
,
passPwd
,
expire
}
=
res
.
data
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论