Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
ccaa6a27
提交
ccaa6a27
authored
2月 26, 2021
作者:
fit2cloud-chenyw
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 恢复误删
上级
b07ea4ab
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
38 个修改的文件
包含
1859 行增加
和
0 行删除
+1859
-0
ChartGroup.java
...end/src/main/java/io/dataease/base/domain/ChartGroup.java
+24
-0
ChartGroupExample.java
.../main/java/io/dataease/base/domain/ChartGroupExample.java
+0
-0
ChartGroupMapper.java
...c/main/java/io/dataease/base/mapper/ChartGroupMapper.java
+31
-0
ChartGroupMapper.xml
...rc/main/java/io/dataease/base/mapper/ChartGroupMapper.xml
+244
-0
ChartController.java
...in/java/io/dataease/controller/chart/ChartController.java
+26
-0
ChartGroupController.java
...va/io/dataease/controller/chart/ChartGroupController.java
+32
-0
ChartGroupRequest.java
.../dataease/controller/request/chart/ChartGroupRequest.java
+11
-0
ChartGroupDTO.java
...nd/src/main/java/io/dataease/dto/chart/ChartGroupDTO.java
+13
-0
NoticeController.java
.../java/io/dataease/notice/controller/NoticeController.java
+36
-0
MessageRequest.java
...io/dataease/notice/controller/request/MessageRequest.java
+11
-0
Mail.java
backend/src/main/java/io/dataease/notice/domain/Mail.java
+18
-0
MailInfo.java
...end/src/main/java/io/dataease/notice/domain/MailInfo.java
+15
-0
MessageDetail.java
...rc/main/java/io/dataease/notice/domain/MessageDetail.java
+21
-0
MessageSettingDetail.java
.../java/io/dataease/notice/domain/MessageSettingDetail.java
+13
-0
UserDetail.java
...d/src/main/java/io/dataease/notice/domain/UserDetail.java
+9
-0
LinkMessage.java
...src/main/java/io/dataease/notice/message/LinkMessage.java
+45
-0
Message.java
...end/src/main/java/io/dataease/notice/message/Message.java
+5
-0
TextMessage.java
...src/main/java/io/dataease/notice/message/TextMessage.java
+64
-0
AbstractNoticeSender.java
.../java/io/dataease/notice/sender/AbstractNoticeSender.java
+150
-0
NoticeModel.java
.../src/main/java/io/dataease/notice/sender/NoticeModel.java
+51
-0
NoticeSender.java
...src/main/java/io/dataease/notice/sender/NoticeSender.java
+9
-0
MailNoticeSender.java
...java/io/dataease/notice/sender/impl/MailNoticeSender.java
+50
-0
WeComNoticeSender.java
...ava/io/dataease/notice/sender/impl/WeComNoticeSender.java
+39
-0
MailService.java
...src/main/java/io/dataease/notice/service/MailService.java
+79
-0
NoticeSendService.java
...in/java/io/dataease/notice/service/NoticeSendService.java
+63
-0
NoticeService.java
...c/main/java/io/dataease/notice/service/NoticeService.java
+160
-0
SendResult.java
...end/src/main/java/io/dataease/notice/util/SendResult.java
+47
-0
WxChatbotClient.java
...rc/main/java/io/dataease/notice/util/WxChatbotClient.java
+50
-0
ChartGroupService.java
...ain/java/io/dataease/service/chart/ChartGroupService.java
+111
-0
V10__chart.sql
backend/src/main/resources/db/migration/V10__chart.sql
+12
-0
favicon.ico
frontend/src/assets/favicon.ico
+0
-0
Chart.vue
frontend/src/business/components/chart/Chart.vue
+45
-0
AddDB.vue
frontend/src/business/components/chart/data/AddDB.vue
+148
-0
ChartHome.vue
frontend/src/business/components/chart/data/ChartHome.vue
+25
-0
TabDataPreview.vue
...end/src/business/components/chart/data/TabDataPreview.vue
+62
-0
ViewTable.vue
frontend/src/business/components/chart/data/ViewTable.vue
+122
-0
Group.vue
frontend/src/business/components/chart/group/Group.vue
+0
-0
router.js
frontend/src/business/components/chart/router.js
+18
-0
没有找到文件。
backend/src/main/java/io/dataease/base/domain/ChartGroup.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
base
.
domain
;
import
java.io.Serializable
;
import
lombok.Data
;
@Data
public
class
ChartGroup
implements
Serializable
{
private
String
id
;
private
String
name
;
private
String
pid
;
private
Integer
level
;
private
String
type
;
private
String
createBy
;
private
Long
createTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/domain/ChartGroupExample.java
0 → 100644
浏览文件 @
ccaa6a27
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
base
.
mapper
;
import
io.dataease.base.domain.ChartGroup
;
import
io.dataease.base.domain.ChartGroupExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
ChartGroupMapper
{
long
countByExample
(
ChartGroupExample
example
);
int
deleteByExample
(
ChartGroupExample
example
);
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
ChartGroup
record
);
int
insertSelective
(
ChartGroup
record
);
List
<
ChartGroup
>
selectByExample
(
ChartGroupExample
example
);
ChartGroup
selectByPrimaryKey
(
String
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
ChartGroup
record
,
@Param
(
"example"
)
ChartGroupExample
example
);
int
updateByExample
(
@Param
(
"record"
)
ChartGroup
record
,
@Param
(
"example"
)
ChartGroupExample
example
);
int
updateByPrimaryKeySelective
(
ChartGroup
record
);
int
updateByPrimaryKey
(
ChartGroup
record
);
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.xml
0 → 100644
浏览文件 @
ccaa6a27
<?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.ChartGroupMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.base.domain.ChartGroup"
>
<id
column=
"id"
jdbcType=
"VARCHAR"
property=
"id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"pid"
jdbcType=
"VARCHAR"
property=
"pid"
/>
<result
column=
"level"
jdbcType=
"INTEGER"
property=
"level"
/>
<result
column=
"type"
jdbcType=
"VARCHAR"
property=
"type"
/>
<result
column=
"create_by"
jdbcType=
"VARCHAR"
property=
"createBy"
/>
<result
column=
"create_time"
jdbcType=
"BIGINT"
property=
"createTime"
/>
</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, `name`, pid, `level`, `type`, create_by, create_time
</sql>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.ChartGroupExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from chart_group
<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.String"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from chart_group
where id = #{id,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from chart_group
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"io.dataease.base.domain.ChartGroupExample"
>
delete from chart_group
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.ChartGroup"
>
insert into chart_group (id, `name`, pid,
`level`, `type`, create_by,
create_time)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR},
#{level,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT})
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.ChartGroup"
>
insert into chart_group
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
`name`,
</if>
<if
test=
"pid != null"
>
pid,
</if>
<if
test=
"level != null"
>
`level`,
</if>
<if
test=
"type != null"
>
`type`,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=VARCHAR},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"pid != null"
>
#{pid,jdbcType=VARCHAR},
</if>
<if
test=
"level != null"
>
#{level,jdbcType=INTEGER},
</if>
<if
test=
"type != null"
>
#{type,jdbcType=VARCHAR},
</if>
<if
test=
"createBy != null"
>
#{createBy,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=BIGINT},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"io.dataease.base.domain.ChartGroupExample"
resultType=
"java.lang.Long"
>
select count(*) from chart_group
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update chart_group
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=VARCHAR},
</if>
<if
test=
"record.name != null"
>
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.pid != null"
>
pid = #{record.pid,jdbcType=VARCHAR},
</if>
<if
test=
"record.level != null"
>
`level` = #{record.level,jdbcType=INTEGER},
</if>
<if
test=
"record.type != null"
>
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if
test=
"record.createBy != null"
>
create_by = #{record.createBy,jdbcType=VARCHAR},
</if>
<if
test=
"record.createTime != null"
>
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update chart_group
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
pid = #{record.pid,jdbcType=VARCHAR},
`level` = #{record.level,jdbcType=INTEGER},
`type` = #{record.type,jdbcType=VARCHAR},
create_by = #{record.createBy,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.dataease.base.domain.ChartGroup"
>
update chart_group
<set>
<if
test=
"name != null"
>
`name` = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"pid != null"
>
pid = #{pid,jdbcType=VARCHAR},
</if>
<if
test=
"level != null"
>
`level` = #{level,jdbcType=INTEGER},
</if>
<if
test=
"type != null"
>
`type` = #{type,jdbcType=VARCHAR},
</if>
<if
test=
"createBy != null"
>
create_by = #{createBy,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=BIGINT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.dataease.base.domain.ChartGroup"
>
update chart_group
set `name` = #{name,jdbcType=VARCHAR},
pid = #{pid,jdbcType=VARCHAR},
`level` = #{level,jdbcType=INTEGER},
`type` = #{type,jdbcType=VARCHAR},
create_by = #{createBy,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/controller/chart/ChartController.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
controller
.
chart
;
import
com.alibaba.fastjson.JSON
;
import
io.dataease.base.domain.DatasetTable
;
import
io.dataease.controller.request.dataset.DataSetTableRequest
;
import
io.dataease.datasource.dto.TableFiled
;
import
io.dataease.service.dataset.DataSetTableService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
"chart/table"
)
public
class
ChartController
{
@PostMapping
(
"list"
)
public
List
<
JSON
>
list
(
@RequestBody
DataSetTableRequest
dataSetTableRequest
)
{
return
new
ArrayList
<>();
}
}
backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
controller
.
chart
;
import
io.dataease.base.domain.ChartGroup
;
import
io.dataease.controller.request.chart.ChartGroupRequest
;
import
io.dataease.dto.chart.ChartGroupDTO
;
import
io.dataease.service.chart.ChartGroupService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
"chart/group"
)
public
class
ChartGroupController
{
@Resource
private
ChartGroupService
chartGroupService
;
@PostMapping
(
"/save"
)
public
ChartGroupDTO
save
(
@RequestBody
ChartGroup
ChartGroup
)
{
return
chartGroupService
.
save
(
ChartGroup
);
}
@PostMapping
(
"/tree"
)
public
List
<
ChartGroupDTO
>
tree
(
@RequestBody
ChartGroupRequest
ChartGroup
)
{
return
chartGroupService
.
tree
(
ChartGroup
);
}
@PostMapping
(
"/delete/{id}"
)
public
void
tree
(
@PathVariable
String
id
)
{
chartGroupService
.
delete
(
id
);
}
}
backend/src/main/java/io/dataease/controller/request/chart/ChartGroupRequest.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
controller
.
request
.
chart
;
import
io.dataease.base.domain.ChartGroup
;
import
io.dataease.base.domain.DatasetGroup
;
import
lombok.Data
;
@Data
public
class
ChartGroupRequest
extends
ChartGroup
{
private
String
sort
;
}
backend/src/main/java/io/dataease/dto/chart/ChartGroupDTO.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
dto
.
chart
;
import
io.dataease.base.domain.DatasetGroup
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
ChartGroupDTO
extends
DatasetGroup
{
private
String
label
;
private
List
<
ChartGroupDTO
>
children
;
}
backend/src/main/java/io/dataease/notice/controller/NoticeController.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
controller
;
import
io.dataease.notice.domain.MessageDetail
;
import
io.dataease.notice.service.NoticeService
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
"notice"
)
public
class
NoticeController
{
@Resource
private
NoticeService
noticeService
;
@PostMapping
(
"save/message/task"
)
public
void
saveMessage
(
@RequestBody
MessageDetail
messageDetail
)
{
noticeService
.
saveMessageTask
(
messageDetail
);
}
@GetMapping
(
"/search/message/type/{type}"
)
public
List
<
MessageDetail
>
searchMessage
(
@PathVariable
String
type
)
{
return
noticeService
.
searchMessageByType
(
type
);
}
@GetMapping
(
"/search/message/{testId}"
)
public
List
<
MessageDetail
>
searchMessageSchedule
(
@PathVariable
String
testId
)
{
return
noticeService
.
searchMessageByTestId
(
testId
);
}
@GetMapping
(
"/delete/message/{identification}"
)
public
int
deleteMessage
(
@PathVariable
String
identification
)
{
return
noticeService
.
delMessage
(
identification
);
}
}
backend/src/main/java/io/dataease/notice/controller/request/MessageRequest.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
controller
.
request
;
import
io.dataease.notice.domain.MessageDetail
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MessageRequest
{
private
List
<
MessageDetail
>
messageDetail
;
}
backend/src/main/java/io/dataease/notice/domain/Mail.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
domain
;
import
lombok.Data
;
@Data
public
class
Mail
{
// 发送给谁
private
String
to
;
// 发送主题
private
String
subject
;
// 发送内容
private
String
content
;
// 附件地址
private
String
filePath
;
}
backend/src/main/java/io/dataease/notice/domain/MailInfo.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
domain
;
import
lombok.Data
;
@Data
public
class
MailInfo
{
private
String
host
;
private
String
port
;
private
String
account
;
private
String
password
;
private
String
ssl
;
private
String
tls
;
private
String
recipient
;
}
backend/src/main/java/io/dataease/notice/domain/MessageDetail.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
domain
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
MessageDetail
{
private
List
<
String
>
userIds
=
new
ArrayList
<>();
private
String
event
;
private
String
taskType
;
private
String
webhook
;
private
String
type
;
private
String
identification
;
private
String
organizationId
;
private
Boolean
isSet
;
private
String
testId
;
private
Long
createTime
;
private
String
template
;
}
backend/src/main/java/io/dataease/notice/domain/MessageSettingDetail.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
domain
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
MessageSettingDetail
{
private
List
<
MessageDetail
>
jenkinsTask
;
private
List
<
MessageDetail
>
testCasePlanTask
;
private
List
<
MessageDetail
>
reviewTask
;
private
List
<
MessageDetail
>
defectTask
;
}
backend/src/main/java/io/dataease/notice/domain/UserDetail.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
domain
;
import
lombok.Data
;
@Data
public
class
UserDetail
{
private
String
email
;
private
String
phone
;
}
backend/src/main/java/io/dataease/notice/message/LinkMessage.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
message
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
public
class
LinkMessage
implements
Message
{
private
String
title
;
private
String
text
;
private
String
picUrl
;
private
String
messageUrl
;
public
String
toJsonString
()
{
Map
<
String
,
Object
>
items
=
new
HashMap
<
String
,
Object
>();
items
.
put
(
"msgtype"
,
"link"
);
Map
<
String
,
String
>
linkContent
=
new
HashMap
<
String
,
String
>();
if
(
StringUtils
.
isBlank
(
title
))
{
throw
new
IllegalArgumentException
(
"title should not be blank"
);
}
linkContent
.
put
(
"title"
,
title
);
if
(
StringUtils
.
isBlank
(
messageUrl
))
{
throw
new
IllegalArgumentException
(
"messageUrl should not be blank"
);
}
linkContent
.
put
(
"messageUrl"
,
messageUrl
);
if
(
StringUtils
.
isBlank
(
text
))
{
throw
new
IllegalArgumentException
(
"text should not be blank"
);
}
linkContent
.
put
(
"text"
,
text
);
if
(
StringUtils
.
isNotBlank
(
picUrl
))
{
linkContent
.
put
(
"picUrl"
,
picUrl
);
}
items
.
put
(
"link"
,
linkContent
);
return
JSON
.
toJSONString
(
items
);
}
}
backend/src/main/java/io/dataease/notice/message/Message.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
message
;
public
interface
Message
{
String
toJsonString
();
}
backend/src/main/java/io/dataease/notice/message/TextMessage.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
message
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
TextMessage
implements
Message
{
private
String
text
;
private
List
<
String
>
mentionedMobileList
;
private
boolean
isAtAll
;
public
TextMessage
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
boolean
isAtAll
()
{
return
isAtAll
;
}
public
void
setIsAtAll
(
boolean
isAtAll
)
{
this
.
isAtAll
=
isAtAll
;
}
public
List
<
String
>
getMentionedMobileList
()
{
return
mentionedMobileList
;
}
public
void
setMentionedMobileList
(
List
<
String
>
mentionedMobileList
)
{
this
.
mentionedMobileList
=
mentionedMobileList
;
}
public
String
toJsonString
()
{
Map
<
String
,
Object
>
items
=
new
HashMap
<
String
,
Object
>();
items
.
put
(
"msgtype"
,
"text"
);
Map
<
String
,
Object
>
textContent
=
new
HashMap
<
String
,
Object
>();
if
(
StringUtils
.
isBlank
(
text
))
{
throw
new
IllegalArgumentException
(
"text should not be blank"
);
}
textContent
.
put
(
"content"
,
text
);
if
(
isAtAll
)
{
if
(
mentionedMobileList
==
null
)
mentionedMobileList
=
new
ArrayList
<
String
>();
mentionedMobileList
.
add
(
"@all"
);
}
if
(
mentionedMobileList
!=
null
&&
!
mentionedMobileList
.
isEmpty
())
{
textContent
.
put
(
"mentioned_mobile_list"
,
mentionedMobileList
);
}
items
.
put
(
"text"
,
textContent
);
return
JSON
.
toJSONString
(
items
);
}
}
backend/src/main/java/io/dataease/notice/sender/AbstractNoticeSender.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
sender
;
import
io.dataease.commons.constants.NoticeConstants
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.notice.domain.MessageDetail
;
import
io.dataease.notice.domain.UserDetail
;
import
io.dataease.service.UserService
;
import
org.apache.commons.collections4.MapUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang3.RegExUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.net.URL
;
import
java.nio.charset.StandardCharsets
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
public
abstract
class
AbstractNoticeSender
implements
NoticeSender
{
@Resource
private
UserService
userService
;
protected
String
getContext
(
MessageDetail
messageDetail
,
NoticeModel
noticeModel
)
{
// 如果配置了模版就直接使用模版
if
(
StringUtils
.
isNotBlank
(
messageDetail
.
getTemplate
()))
{
return
getContent
(
messageDetail
.
getTemplate
(),
noticeModel
.
getParamMap
());
}
// 处理 userIds 中包含的特殊值
List
<
String
>
realUserIds
=
getRealUserIds
(
messageDetail
.
getUserIds
(),
noticeModel
.
getRelatedUsers
(),
messageDetail
.
getEvent
());
messageDetail
.
setUserIds
(
realUserIds
);
// 处理 WeCom Ding context
String
context
=
""
;
switch
(
messageDetail
.
getEvent
())
{
case
NoticeConstants
.
Event
.
CREATE
:
case
NoticeConstants
.
Event
.
UPDATE
:
case
NoticeConstants
.
Event
.
DELETE
:
case
NoticeConstants
.
Event
.
COMMENT
:
context
=
noticeModel
.
getContext
();
break
;
case
NoticeConstants
.
Event
.
EXECUTE_FAILED
:
context
=
noticeModel
.
getFailedContext
();
break
;
case
NoticeConstants
.
Event
.
EXECUTE_SUCCESSFUL
:
context
=
noticeModel
.
getSuccessContext
();
break
;
default
:
break
;
}
return
context
;
}
protected
String
getHtmlContext
(
MessageDetail
messageDetail
,
NoticeModel
noticeModel
)
{
// 如果配置了模版就直接使用模版
if
(
StringUtils
.
isNotBlank
(
messageDetail
.
getTemplate
()))
{
return
getContent
(
messageDetail
.
getTemplate
(),
noticeModel
.
getParamMap
());
}
// 处理 userIds 中包含的特殊值
List
<
String
>
realUserIds
=
getRealUserIds
(
messageDetail
.
getUserIds
(),
noticeModel
.
getRelatedUsers
(),
messageDetail
.
getEvent
());
messageDetail
.
setUserIds
(
realUserIds
);
// 处理 mail context
String
context
=
""
;
try
{
switch
(
messageDetail
.
getEvent
())
{
case
NoticeConstants
.
Event
.
CREATE
:
case
NoticeConstants
.
Event
.
UPDATE
:
case
NoticeConstants
.
Event
.
DELETE
:
case
NoticeConstants
.
Event
.
COMMENT
:
URL
resource
=
this
.
getClass
().
getResource
(
"/mail/"
+
noticeModel
.
getMailTemplate
()
+
".html"
);
context
=
IOUtils
.
toString
(
resource
,
StandardCharsets
.
UTF_8
);
break
;
case
NoticeConstants
.
Event
.
EXECUTE_FAILED
:
URL
resource1
=
this
.
getClass
().
getResource
(
"/mail/"
+
noticeModel
.
getFailedMailTemplate
()
+
".html"
);
context
=
IOUtils
.
toString
(
resource1
,
StandardCharsets
.
UTF_8
);
break
;
case
NoticeConstants
.
Event
.
EXECUTE_SUCCESSFUL
:
URL
resource2
=
this
.
getClass
().
getResource
(
"/mail/"
+
noticeModel
.
getSuccessMailTemplate
()
+
".html"
);
context
=
IOUtils
.
toString
(
resource2
,
StandardCharsets
.
UTF_8
);
break
;
default
:
break
;
}
}
catch
(
IOException
e
)
{
LogUtil
.
error
(
e
);
}
return
getContent
(
context
,
noticeModel
.
getParamMap
());
}
protected
String
getContent
(
String
template
,
Map
<
String
,
Object
>
context
)
{
if
(
MapUtils
.
isNotEmpty
(
context
))
{
for
(
String
k
:
context
.
keySet
())
{
if
(
context
.
get
(
k
)
!=
null
)
{
template
=
RegExUtils
.
replaceAll
(
template
,
"\\$\\{"
+
k
+
"}"
,
context
.
get
(
k
).
toString
());
}
else
{
template
=
RegExUtils
.
replaceAll
(
template
,
"\\$\\{"
+
k
+
"}"
,
"未设置"
);
}
}
}
return
template
;
}
protected
List
<
String
>
getUserPhones
(
List
<
String
>
userIds
)
{
List
<
UserDetail
>
list
=
userService
.
queryTypeByIds
(
userIds
);
List
<
String
>
phoneList
=
new
ArrayList
<>();
list
.
forEach
(
u
->
phoneList
.
add
(
u
.
getPhone
()));
LogUtil
.
info
(
"收件人地址: "
+
phoneList
);
return
phoneList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
protected
List
<
String
>
getUserEmails
(
List
<
String
>
userIds
)
{
List
<
UserDetail
>
list
=
userService
.
queryTypeByIds
(
userIds
);
List
<
String
>
phoneList
=
new
ArrayList
<>();
list
.
forEach
(
u
->
phoneList
.
add
(
u
.
getEmail
()));
LogUtil
.
info
(
"收件人地址: "
+
phoneList
);
return
phoneList
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
}
private
List
<
String
>
getRealUserIds
(
List
<
String
>
userIds
,
List
<
String
>
relatedUsers
,
String
event
)
{
List
<
String
>
toUserIds
=
new
ArrayList
<>();
for
(
String
userId
:
userIds
)
{
switch
(
userId
)
{
case
NoticeConstants
.
RelatedUser
.
EXECUTOR
:
if
(
StringUtils
.
equals
(
NoticeConstants
.
Event
.
CREATE
,
event
))
{
toUserIds
.
addAll
(
relatedUsers
);
}
break
;
case
NoticeConstants
.
RelatedUser
.
FOUNDER
:
if
(
StringUtils
.
equals
(
NoticeConstants
.
Event
.
UPDATE
,
event
)
||
StringUtils
.
equals
(
NoticeConstants
.
Event
.
DELETE
,
event
))
{
toUserIds
.
addAll
(
relatedUsers
);
}
break
;
case
NoticeConstants
.
RelatedUser
.
MAINTAINER
:
if
(
StringUtils
.
equals
(
NoticeConstants
.
Event
.
COMMENT
,
event
))
{
toUserIds
.
addAll
(
relatedUsers
);
}
break
;
default
:
toUserIds
.
add
(
userId
);
break
;
}
}
return
toUserIds
;
}
}
backend/src/main/java/io/dataease/notice/sender/NoticeModel.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
sender
;
import
lombok.Builder
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
@Data
@Builder
public
class
NoticeModel
{
/**
* 保存 测试id
*/
private
String
testId
;
/**
* 保存状态
*/
private
String
status
;
/**
* Event
*/
private
String
event
;
/**
* 消息主题
*/
private
String
subject
;
/**
* 消息内容
*/
private
String
context
;
private
String
successContext
;
private
String
failedContext
;
/**
* html 消息模版
*/
private
String
mailTemplate
;
private
String
failedMailTemplate
;
private
String
successMailTemplate
;
/**
* 保存特殊的用户
*/
private
List
<
String
>
relatedUsers
;
/**
* 模版里的参数信息
*/
private
Map
<
String
,
Object
>
paramMap
;
}
backend/src/main/java/io/dataease/notice/sender/NoticeSender.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
sender
;
import
io.dataease.notice.domain.MessageDetail
;
import
org.springframework.scheduling.annotation.Async
;
public
interface
NoticeSender
{
@Async
void
send
(
MessageDetail
messageDetail
,
NoticeModel
noticeModel
);
}
backend/src/main/java/io/dataease/notice/sender/impl/MailNoticeSender.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
sender
.
impl
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.notice.domain.MessageDetail
;
import
io.dataease.notice.sender.AbstractNoticeSender
;
import
io.dataease.notice.sender.NoticeModel
;
import
io.dataease.notice.service.MailService
;
import
org.springframework.mail.javamail.JavaMailSenderImpl
;
import
org.springframework.mail.javamail.MimeMessageHelper
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.mail.MessagingException
;
import
javax.mail.internet.MimeMessage
;
import
java.util.List
;
@Component
public
class
MailNoticeSender
extends
AbstractNoticeSender
{
@Resource
private
MailService
mailService
;
private
void
sendMail
(
MessageDetail
messageDetail
,
String
context
,
NoticeModel
noticeModel
)
throws
MessagingException
{
LogUtil
.
info
(
"发送邮件开始 "
);
JavaMailSenderImpl
javaMailSender
=
mailService
.
getMailSender
();
MimeMessage
mimeMessage
=
javaMailSender
.
createMimeMessage
();
MimeMessageHelper
helper
=
new
MimeMessageHelper
(
mimeMessage
,
true
);
helper
.
setFrom
(
javaMailSender
.
getUsername
());
LogUtil
.
info
(
"发件人地址"
+
javaMailSender
.
getUsername
());
LogUtil
.
info
(
"helper"
+
helper
);
helper
.
setSubject
(
"MeterSphere "
+
noticeModel
.
getSubject
());
List
<
String
>
emails
=
super
.
getUserEmails
(
messageDetail
.
getUserIds
());
String
[]
users
=
emails
.
toArray
(
new
String
[
0
]);
LogUtil
.
info
(
"收件人地址: "
+
emails
);
helper
.
setText
(
context
,
true
);
helper
.
setTo
(
users
);
javaMailSender
.
send
(
mimeMessage
);
}
@Override
public
void
send
(
MessageDetail
messageDetail
,
NoticeModel
noticeModel
)
{
String
context
=
super
.
getHtmlContext
(
messageDetail
,
noticeModel
);
try
{
sendMail
(
messageDetail
,
context
,
noticeModel
);
LogUtil
.
info
(
"发送邮件结束"
);
}
catch
(
Exception
e
)
{
LogUtil
.
error
(
e
);
}
}
}
backend/src/main/java/io/dataease/notice/sender/impl/WeComNoticeSender.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
sender
.
impl
;
import
io.dataease.notice.sender.AbstractNoticeSender
;
import
io.dataease.commons.utils.LogUtil
;
import
io.dataease.notice.domain.MessageDetail
;
import
io.dataease.notice.message.TextMessage
;
import
io.dataease.notice.sender.NoticeModel
;
import
io.dataease.notice.util.WxChatbotClient
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.util.List
;
@Component
public
class
WeComNoticeSender
extends
AbstractNoticeSender
{
public
void
sendWechatRobot
(
MessageDetail
messageDetail
,
String
context
)
{
List
<
String
>
userIds
=
messageDetail
.
getUserIds
();
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
;
}
TextMessage
message
=
new
TextMessage
(
context
);
List
<
String
>
phoneLists
=
super
.
getUserPhones
(
userIds
);
message
.
setMentionedMobileList
(
phoneLists
);
try
{
WxChatbotClient
.
send
(
messageDetail
.
getWebhook
(),
message
);
}
catch
(
IOException
e
)
{
LogUtil
.
error
(
e
.
getMessage
(),
e
);
}
}
@Override
public
void
send
(
MessageDetail
messageDetail
,
NoticeModel
noticeModel
)
{
String
context
=
super
.
getContext
(
messageDetail
,
noticeModel
);
sendWechatRobot
(
messageDetail
,
context
);
}
}
backend/src/main/java/io/dataease/notice/service/MailService.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
service
;
import
io.dataease.base.domain.SystemParameter
;
import
io.dataease.commons.constants.ParamConstants
;
import
io.dataease.commons.utils.EncryptUtils
;
import
io.dataease.service.system.SystemParameterService
;
import
org.apache.commons.lang3.BooleanUtils
;
import
org.springframework.mail.javamail.JavaMailSenderImpl
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.Properties
;
@Service
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
class
MailService
{
@Resource
private
SystemParameterService
systemParameterService
;
public
JavaMailSenderImpl
getMailSender
()
{
Properties
props
=
new
Properties
();
JavaMailSenderImpl
javaMailSender
=
new
JavaMailSenderImpl
();
List
<
SystemParameter
>
paramList
=
systemParameterService
.
getParamList
(
ParamConstants
.
Classify
.
MAIL
.
getValue
());
javaMailSender
.
setDefaultEncoding
(
"UTF-8"
);
javaMailSender
.
setProtocol
(
"smtp"
);
props
.
put
(
"mail.smtp.auth"
,
"true"
);
for
(
SystemParameter
p
:
paramList
)
{
switch
(
p
.
getParamKey
())
{
case
"smtp.host"
:
javaMailSender
.
setHost
(
p
.
getParamValue
());
break
;
case
"smtp.port"
:
javaMailSender
.
setPort
(
Integer
.
parseInt
(
p
.
getParamValue
()));
break
;
case
"smtp.account"
:
javaMailSender
.
setUsername
(
p
.
getParamValue
());
break
;
case
"smtp.password"
:
javaMailSender
.
setPassword
(
EncryptUtils
.
aesDecrypt
(
p
.
getParamValue
()).
toString
());
break
;
case
"smtp.ssl"
:
if
(
BooleanUtils
.
toBoolean
(
p
.
getParamValue
()))
{
javaMailSender
.
setProtocol
(
"smtps"
);
props
.
put
(
"mail.smtp.socketFactory.class"
,
"javax.net.ssl.SSLSocketFactory"
);
}
break
;
case
"smtp.tls"
:
String
result
=
BooleanUtils
.
toString
(
BooleanUtils
.
toBoolean
(
p
.
getParamValue
()),
"true"
,
"false"
);
props
.
put
(
"mail.smtp.starttls.enable"
,
result
);
props
.
put
(
"mail.smtp.starttls.required"
,
result
);
break
;
/* case "smtp.anon":
boolean isAnon = BooleanUtils.toBoolean(p.getParamValue());
if (isAnon) {
props.put("mail.smtp.auth", "false");
javaMailSender.setUsername(null);
javaMailSender.setPassword(null);
}
break;*/
default
:
break
;
}
}
props
.
put
(
"mail.smtp.timeout"
,
"30000"
);
props
.
put
(
"mail.smtp.connectiontimeout"
,
"5000"
);
javaMailSender
.
setJavaMailProperties
(
props
);
return
javaMailSender
;
}
}
backend/src/main/java/io/dataease/notice/service/NoticeSendService.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
service
;
import
io.dataease.commons.constants.NoticeConstants
;
import
io.dataease.notice.domain.MessageDetail
;
import
io.dataease.notice.sender.NoticeModel
;
import
io.dataease.notice.sender.NoticeSender
;
import
io.dataease.notice.sender.impl.MailNoticeSender
;
import
io.dataease.notice.sender.impl.WeComNoticeSender
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.util.List
;
@Component
public
class
NoticeSendService
{
@Resource
private
MailNoticeSender
mailNoticeSender
;
@Resource
private
WeComNoticeSender
weComNoticeSender
;
@Resource
private
NoticeService
noticeService
;
private
NoticeSender
getNoticeSender
(
MessageDetail
messageDetail
)
{
NoticeSender
noticeSender
=
null
;
switch
(
messageDetail
.
getType
())
{
case
NoticeConstants
.
Type
.
EMAIL
:
noticeSender
=
mailNoticeSender
;
break
;
case
NoticeConstants
.
Type
.
WECHAT_ROBOT
:
noticeSender
=
weComNoticeSender
;
break
;
// case NoticeConstants.Type.NAIL_ROBOT:
// noticeSender = dingNoticeSender;
// break;
default
:
break
;
}
return
noticeSender
;
}
public
void
send
(
String
taskType
,
NoticeModel
noticeModel
)
{
List
<
MessageDetail
>
messageDetails
;
switch
(
taskType
)
{
case
NoticeConstants
.
Mode
.
API
:
messageDetails
=
noticeService
.
searchMessageByType
(
NoticeConstants
.
TaskType
.
JENKINS_TASK
);
break
;
case
NoticeConstants
.
Mode
.
SCHEDULE
:
messageDetails
=
noticeService
.
searchMessageByTestId
(
noticeModel
.
getTestId
());
break
;
default
:
messageDetails
=
noticeService
.
searchMessageByType
(
taskType
);
break
;
}
messageDetails
.
forEach
(
messageDetail
->
{
if
(
StringUtils
.
equals
(
messageDetail
.
getEvent
(),
noticeModel
.
getEvent
()))
{
this
.
getNoticeSender
(
messageDetail
).
send
(
messageDetail
,
noticeModel
);
}
});
}
}
backend/src/main/java/io/dataease/notice/service/NoticeService.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
service
;
import
io.dataease.base.domain.MessageTask
;
import
io.dataease.base.domain.MessageTaskExample
;
import
io.dataease.base.mapper.MessageTaskMapper
;
import
io.dataease.commons.exception.DEException
;
import
io.dataease.commons.user.SessionUser
;
import
io.dataease.commons.utils.SessionUtils
;
import
io.dataease.i18n.Translator
;
import
io.dataease.notice.domain.MessageDetail
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
class
NoticeService
{
@Resource
private
MessageTaskMapper
messageTaskMapper
;
public
void
saveMessageTask
(
MessageDetail
messageDetail
)
{
MessageTaskExample
example
=
new
MessageTaskExample
();
example
.
createCriteria
().
andIdentificationEqualTo
(
messageDetail
.
getIdentification
());
List
<
MessageTask
>
messageTaskLists
=
messageTaskMapper
.
selectByExample
(
example
);
if
(
messageTaskLists
.
size
()
>
0
)
{
delMessage
(
messageDetail
.
getIdentification
());
}
SessionUser
user
=
SessionUtils
.
getUser
();
String
orgId
=
user
.
getLastOrganizationId
();
long
time
=
System
.
currentTimeMillis
();
String
identification
=
messageDetail
.
getIdentification
();
if
(
StringUtils
.
isBlank
(
identification
))
{
identification
=
UUID
.
randomUUID
().
toString
();
}
for
(
String
userId
:
messageDetail
.
getUserIds
())
{
checkUserIdExist
(
userId
,
messageDetail
,
orgId
);
MessageTask
messageTask
=
new
MessageTask
();
messageTask
.
setId
(
UUID
.
randomUUID
().
toString
());
messageTask
.
setEvent
(
messageDetail
.
getEvent
());
messageTask
.
setTaskType
(
messageDetail
.
getTaskType
());
messageTask
.
setUserId
(
userId
);
messageTask
.
setType
(
messageDetail
.
getType
());
messageTask
.
setWebhook
(
messageDetail
.
getWebhook
());
messageTask
.
setIdentification
(
identification
);
messageTask
.
setIsSet
(
false
);
messageTask
.
setOrganizationId
(
orgId
);
messageTask
.
setTestId
(
messageDetail
.
getTestId
());
messageTask
.
setCreateTime
(
time
);
setTemplate
(
messageDetail
,
messageTask
);
messageTaskMapper
.
insert
(
messageTask
);
}
}
private
void
setTemplate
(
MessageDetail
messageDetail
,
MessageTask
messageTask
)
{
if
(
StringUtils
.
isNotBlank
(
messageDetail
.
getTemplate
()))
{
messageTask
.
setTemplate
(
messageDetail
.
getTemplate
());
}
}
private
void
checkUserIdExist
(
String
userId
,
MessageDetail
list
,
String
orgId
)
{
MessageTaskExample
example
=
new
MessageTaskExample
();
if
(
StringUtils
.
isBlank
(
list
.
getTestId
()))
{
example
.
createCriteria
()
.
andUserIdEqualTo
(
userId
)
.
andEventEqualTo
(
list
.
getEvent
())
.
andTypeEqualTo
(
list
.
getType
())
.
andTaskTypeEqualTo
(
list
.
getTaskType
())
.
andWebhookEqualTo
(
list
.
getWebhook
())
.
andOrganizationIdEqualTo
(
orgId
);
}
else
{
example
.
createCriteria
()
.
andUserIdEqualTo
(
userId
)
.
andEventEqualTo
(
list
.
getEvent
())
.
andTypeEqualTo
(
list
.
getType
())
.
andTaskTypeEqualTo
(
list
.
getTaskType
())
.
andWebhookEqualTo
(
list
.
getWebhook
())
.
andTestIdEqualTo
(
list
.
getTestId
())
.
andOrganizationIdEqualTo
(
orgId
);
}
if
(
messageTaskMapper
.
countByExample
(
example
)
>
0
)
{
DEException
.
throwException
(
Translator
.
get
(
"message_task_already_exists"
));
}
}
public
List
<
MessageDetail
>
searchMessageByTestId
(
String
testId
)
{
MessageTaskExample
example
=
new
MessageTaskExample
();
example
.
createCriteria
().
andTestIdEqualTo
(
testId
);
List
<
MessageTask
>
messageTaskLists
=
messageTaskMapper
.
selectByExampleWithBLOBs
(
example
);
List
<
MessageDetail
>
scheduleMessageTask
=
new
ArrayList
<>();
Map
<
String
,
List
<
MessageTask
>>
MessageTaskMap
=
messageTaskLists
.
stream
().
collect
(
Collectors
.
groupingBy
(
MessageTask:
:
getIdentification
));
MessageTaskMap
.
forEach
((
k
,
v
)
->
{
MessageDetail
messageDetail
=
getMessageDetail
(
v
);
scheduleMessageTask
.
add
(
messageDetail
);
});
scheduleMessageTask
.
sort
(
Comparator
.
comparing
(
MessageDetail:
:
getCreateTime
,
Comparator
.
nullsLast
(
Long:
:
compareTo
)).
reversed
());
return
scheduleMessageTask
;
}
public
List
<
MessageDetail
>
searchMessageByType
(
String
type
)
{
SessionUser
user
=
SessionUtils
.
getUser
();
String
orgId
=
user
.
getLastOrganizationId
();
List
<
MessageDetail
>
messageDetails
=
new
ArrayList
<>();
MessageTaskExample
example
=
new
MessageTaskExample
();
example
.
createCriteria
()
.
andTaskTypeEqualTo
(
type
)
.
andOrganizationIdEqualTo
(
orgId
);
List
<
MessageTask
>
messageTaskLists
=
messageTaskMapper
.
selectByExampleWithBLOBs
(
example
);
Map
<
String
,
List
<
MessageTask
>>
messageTaskMap
=
messageTaskLists
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
NoticeService:
:
fetchGroupKey
));
messageTaskMap
.
forEach
((
k
,
v
)
->
{
MessageDetail
messageDetail
=
getMessageDetail
(
v
);
messageDetails
.
add
(
messageDetail
);
});
return
messageDetails
.
stream
()
.
sorted
(
Comparator
.
comparing
(
MessageDetail:
:
getCreateTime
,
Comparator
.
nullsLast
(
Long:
:
compareTo
)).
reversed
())
.
collect
(
Collectors
.
toList
())
.
stream
()
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
private
MessageDetail
getMessageDetail
(
List
<
MessageTask
>
messageTasks
)
{
Set
<
String
>
userIds
=
new
HashSet
<>();
MessageDetail
messageDetail
=
new
MessageDetail
();
for
(
MessageTask
m
:
messageTasks
)
{
userIds
.
add
(
m
.
getUserId
());
messageDetail
.
setEvent
(
m
.
getEvent
());
messageDetail
.
setTaskType
(
m
.
getTaskType
());
messageDetail
.
setWebhook
(
m
.
getWebhook
());
messageDetail
.
setIdentification
(
m
.
getIdentification
());
messageDetail
.
setType
(
m
.
getType
());
messageDetail
.
setIsSet
(
m
.
getIsSet
());
messageDetail
.
setCreateTime
(
m
.
getCreateTime
());
messageDetail
.
setTemplate
(
m
.
getTemplate
());
}
if
(
CollectionUtils
.
isNotEmpty
(
userIds
))
{
messageDetail
.
setUserIds
(
new
ArrayList
<>(
userIds
));
}
return
messageDetail
;
}
private
static
String
fetchGroupKey
(
MessageTask
messageTask
)
{
return
messageTask
.
getTaskType
()
+
"#"
+
messageTask
.
getIdentification
();
}
public
int
delMessage
(
String
identification
)
{
MessageTaskExample
example
=
new
MessageTaskExample
();
example
.
createCriteria
().
andIdentificationEqualTo
(
identification
);
return
messageTaskMapper
.
deleteByExample
(
example
);
}
}
backend/src/main/java/io/dataease/notice/util/SendResult.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
util
;
import
com.alibaba.fastjson.JSON
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
*
*/
public
class
SendResult
{
private
boolean
isSuccess
;
private
Integer
errorCode
;
private
String
errorMsg
;
public
boolean
isSuccess
()
{
return
isSuccess
;
}
public
void
setIsSuccess
(
boolean
isSuccess
)
{
this
.
isSuccess
=
isSuccess
;
}
public
Integer
getErrorCode
()
{
return
errorCode
;
}
public
void
setErrorCode
(
Integer
errorCode
)
{
this
.
errorCode
=
errorCode
;
}
public
String
getErrorMsg
()
{
return
errorMsg
;
}
public
void
setErrorMsg
(
String
errorMsg
)
{
this
.
errorMsg
=
errorMsg
;
}
public
String
toString
()
{
Map
<
String
,
Object
>
items
=
new
HashMap
<
String
,
Object
>();
items
.
put
(
"errorCode"
,
errorCode
);
items
.
put
(
"errorMsg"
,
errorMsg
);
items
.
put
(
"isSuccess"
,
isSuccess
);
return
JSON
.
toJSONString
(
items
);
}
}
backend/src/main/java/io/dataease/notice/util/WxChatbotClient.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
notice
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
io.dataease.notice.message.Message
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.HttpStatus
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.util.EntityUtils
;
import
java.io.IOException
;
/**
*
*/
public
class
WxChatbotClient
{
static
HttpClient
httpclient
=
HttpClients
.
createDefault
();
public
static
SendResult
send
(
String
webhook
,
Message
message
)
throws
IOException
{
if
(
StringUtils
.
isBlank
(
webhook
))
{
return
new
SendResult
();
}
HttpPost
httppost
=
new
HttpPost
(
webhook
);
httppost
.
addHeader
(
"Content-Type"
,
"application/json; charset=utf-8"
);
StringEntity
se
=
new
StringEntity
(
message
.
toJsonString
(),
"utf-8"
);
httppost
.
setEntity
(
se
);
SendResult
sendResult
=
new
SendResult
();
HttpResponse
response
=
httpclient
.
execute
(
httppost
);
if
(
response
.
getStatusLine
().
getStatusCode
()
==
HttpStatus
.
SC_OK
)
{
String
result
=
EntityUtils
.
toString
(
response
.
getEntity
());
JSONObject
obj
=
JSONObject
.
parseObject
(
result
);
Integer
errcode
=
obj
.
getInteger
(
"errcode"
);
sendResult
.
setErrorCode
(
errcode
);
sendResult
.
setErrorMsg
(
obj
.
getString
(
"errmsg"
));
sendResult
.
setIsSuccess
(
errcode
.
equals
(
0
));
}
return
sendResult
;
}
}
backend/src/main/java/io/dataease/service/chart/ChartGroupService.java
0 → 100644
浏览文件 @
ccaa6a27
package
io
.
dataease
.
service
.
chart
;
import
io.dataease.base.domain.ChartGroup
;
import
io.dataease.base.domain.ChartGroupExample
;
import
io.dataease.base.mapper.ChartGroupMapper
;
import
io.dataease.commons.utils.BeanUtils
;
import
io.dataease.controller.request.chart.ChartGroupRequest
;
import
io.dataease.dto.chart.ChartGroupDTO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.UUID
;
import
java.util.stream.Collectors
;
@Service
public
class
ChartGroupService
{
@Resource
private
ChartGroupMapper
chartGroupMapper
;
public
ChartGroupDTO
save
(
ChartGroup
chartGroup
)
{
if
(
StringUtils
.
isEmpty
(
chartGroup
.
getId
()))
{
chartGroup
.
setId
(
UUID
.
randomUUID
().
toString
());
chartGroup
.
setCreateTime
(
System
.
currentTimeMillis
());
chartGroupMapper
.
insert
(
chartGroup
);
}
else
{
chartGroupMapper
.
updateByPrimaryKey
(
chartGroup
);
}
ChartGroupDTO
ChartGroupDTO
=
new
ChartGroupDTO
();
BeanUtils
.
copyBean
(
ChartGroupDTO
,
chartGroup
);
ChartGroupDTO
.
setLabel
(
ChartGroupDTO
.
getName
());
return
ChartGroupDTO
;
}
public
void
delete
(
String
id
)
{
ChartGroupRequest
ChartGroup
=
new
ChartGroupRequest
();
ChartGroup
.
setId
(
id
);
List
<
ChartGroupDTO
>
tree
=
tree
(
ChartGroup
);
List
<
String
>
ids
=
new
ArrayList
<>();
getAllId
(
tree
,
ids
);
ChartGroupExample
ChartGroupExample
=
new
ChartGroupExample
();
ChartGroupExample
.
createCriteria
().
andIdIn
(
ids
);
chartGroupMapper
.
deleteByExample
(
ChartGroupExample
);
}
public
List
<
ChartGroupDTO
>
tree
(
ChartGroupRequest
ChartGroup
)
{
ChartGroupExample
ChartGroupExample
=
new
ChartGroupExample
();
ChartGroupExample
.
Criteria
criteria
=
ChartGroupExample
.
createCriteria
();
if
(
StringUtils
.
isNotEmpty
(
ChartGroup
.
getName
()))
{
criteria
.
andNameLike
(
"%"
+
ChartGroup
.
getName
()
+
"%"
);
}
if
(
StringUtils
.
isNotEmpty
(
ChartGroup
.
getType
()))
{
criteria
.
andTypeEqualTo
(
ChartGroup
.
getType
());
}
if
(
StringUtils
.
isNotEmpty
(
ChartGroup
.
getId
()))
{
criteria
.
andIdEqualTo
(
ChartGroup
.
getId
());
}
else
{
criteria
.
andLevelEqualTo
(
0
);
}
ChartGroupExample
.
setOrderByClause
(
ChartGroup
.
getSort
());
List
<
ChartGroup
>
ChartGroups
=
chartGroupMapper
.
selectByExample
(
ChartGroupExample
);
List
<
ChartGroupDTO
>
DTOs
=
ChartGroups
.
stream
().
map
(
ele
->
{
ChartGroupDTO
dto
=
new
ChartGroupDTO
();
BeanUtils
.
copyBean
(
dto
,
ele
);
dto
.
setLabel
(
ele
.
getName
());
return
dto
;
}).
collect
(
Collectors
.
toList
());
getAll
(
DTOs
,
ChartGroup
);
return
DTOs
;
}
public
void
getAll
(
List
<
ChartGroupDTO
>
list
,
ChartGroupRequest
ChartGroup
)
{
for
(
ChartGroupDTO
obj
:
list
)
{
ChartGroupExample
ChartGroupExample
=
new
ChartGroupExample
();
ChartGroupExample
.
Criteria
criteria
=
ChartGroupExample
.
createCriteria
();
if
(
StringUtils
.
isNotEmpty
(
ChartGroup
.
getName
()))
{
criteria
.
andNameLike
(
"%"
+
ChartGroup
.
getName
()
+
"%"
);
}
if
(
StringUtils
.
isNotEmpty
(
ChartGroup
.
getType
()))
{
criteria
.
andTypeEqualTo
(
ChartGroup
.
getType
());
}
criteria
.
andPidEqualTo
(
obj
.
getId
());
ChartGroupExample
.
setOrderByClause
(
ChartGroup
.
getSort
());
List
<
ChartGroup
>
ChartGroups
=
chartGroupMapper
.
selectByExample
(
ChartGroupExample
);
List
<
ChartGroupDTO
>
DTOs
=
ChartGroups
.
stream
().
map
(
ele
->
{
ChartGroupDTO
dto
=
new
ChartGroupDTO
();
BeanUtils
.
copyBean
(
dto
,
ele
);
dto
.
setLabel
(
ele
.
getName
());
return
dto
;
}).
collect
(
Collectors
.
toList
());
obj
.
setChildren
(
DTOs
);
if
(
CollectionUtils
.
isNotEmpty
(
DTOs
))
{
getAll
(
DTOs
,
ChartGroup
);
}
}
}
public
List
<
String
>
getAllId
(
List
<
ChartGroupDTO
>
list
,
List
<
String
>
ids
)
{
for
(
ChartGroupDTO
dto
:
list
)
{
ids
.
add
(
dto
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
dto
.
getChildren
()))
{
getAllId
(
dto
.
getChildren
(),
ids
);
}
}
return
ids
;
}
}
backend/src/main/resources/db/migration/V10__chart.sql
0 → 100644
浏览文件 @
ccaa6a27
-- chart start
CREATE
TABLE
IF
NOT
EXISTS
`chart_group`
(
`id`
varchar
(
50
)
NOT
NULL
COMMENT
'ID'
,
`name`
varchar
(
64
)
NOT
NULL
COMMENT
'名称'
,
`pid`
varchar
(
50
)
COMMENT
'父级ID'
,
`level`
int
(
10
)
COMMENT
'当前分组处于第几级'
,
`type`
varchar
(
50
)
COMMENT
'group or scene'
,
`create_by`
varchar
(
50
)
COMMENT
'创建人ID'
,
`create_time`
bigint
(
13
)
COMMENT
'创建时间'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
;
-- chart end
frontend/src/assets/favicon.ico
0 → 100644
浏览文件 @
ccaa6a27
107.4 KB
frontend/src/business/components/chart/Chart.vue
0 → 100644
浏览文件 @
ccaa6a27
<
template
>
<ms-container>
<ms-aside-container>
<group/>
</ms-aside-container>
<ms-main-container>
<keep-alive>
<router-view/>
</keep-alive>
</ms-main-container>
</ms-container>
</
template
>
<
script
>
import
MsMainContainer
from
"../common/components/MsMainContainer"
;
import
MsContainer
from
"../common/components/MsContainer"
;
import
MsAsideContainer
from
"../common/components/MsAsideContainer"
;
import
MsSettingMenu
from
"../settings/SettingMenu"
;
import
MsCurrentUser
from
"../settings/CurrentUser"
;
import
Group
from
"./group/Group"
;
export
default
{
name
:
"Chart"
,
components
:
{
MsMainContainer
,
MsContainer
,
MsAsideContainer
,
MsSettingMenu
,
MsCurrentUser
,
Group
},
data
()
{
return
{}
}
}
</
script
>
<
style
scoped
>
.ms-aside-container
{
height
:
calc
(
100vh
-
40px
);
padding
:
15px
;
min-width
:
300px
;
max-width
:
500px
;
}
.ms-main-container
{
height
:
calc
(
100vh
-
40px
);
}
</
style
>
frontend/src/business/components/chart/data/AddDB.vue
0 → 100644
浏览文件 @
ccaa6a27
<
template
>
<el-col>
<el-row>
<el-row
style=
"height: 26px;"
>
<span
style=
"line-height: 26px;"
>
{{
$t
(
'dataset.add_db_table'
)
}}
</span>
<el-row
style=
"float: right"
>
<el-button
size=
"mini"
@
click=
"cancel"
>
{{
$t
(
'dataset.cancel'
)
}}
</el-button>
<el-button
size=
"mini"
type=
"primary"
@
click=
"save"
:disabled=
"checkTableList.length
<
1
"
>
{{
$t
(
'dataset.confirm'
)
}}
</el-button>
</el-row>
</el-row>
<el-divider/>
<el-row>
<el-form
:inline=
"true"
>
<el-form-item
class=
"form-item"
>
<el-select
v-model=
"dataSource"
filterable
:placeholder=
"$t('dataset.pls_slc_data_source')"
size=
"mini"
>
<el-option
v-for=
"item in options"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item
class=
"form-item"
style=
"float: right;"
>
<el-input
size=
"mini"
:placeholder=
"$t('dataset.search')"
prefix-icon=
"el-icon-search"
v-model=
"searchTable"
clearable
>
</el-input>
</el-form-item>
</el-form>
</el-row>
<el-row
style=
"overflow: auto;height: 600px;"
>
<el-checkbox-group
v-model=
"checkTableList"
size=
"small"
>
<el-checkbox
border
v-for=
"t in tables"
:label=
"t"
:key=
"t"
>
</el-checkbox>
</el-checkbox-group>
</el-row>
</el-row>
</el-col>
</
template
>
<
script
>
export
default
{
name
:
"AddDB"
,
data
()
{
return
{
searchTable
:
''
,
options
:
[],
dataSource
:
''
,
tables
:
[],
checkTableList
:
[],
scene
:
null
}
},
mounted
()
{
this
.
initDataSource
();
this
.
scene
=
this
.
$route
.
params
.
scene
;
},
activated
()
{
this
.
initDataSource
();
this
.
scene
=
this
.
$route
.
params
.
scene
;
},
methods
:
{
initDataSource
()
{
this
.
$get
(
"/datasource/list"
,
response
=>
{
this
.
options
=
response
.
data
;
})
},
save
()
{
// console.log(this.checkTableList);
// console.log(this.scene);
let
sceneId
=
this
.
scene
.
id
;
let
dataSourceId
=
this
.
dataSource
;
let
tables
=
[];
this
.
checkTableList
.
forEach
(
function
(
name
)
{
tables
.
push
({
name
:
name
,
sceneId
:
sceneId
,
dataSourceId
:
dataSourceId
,
type
:
'db'
})
});
this
.
$post
(
'/dataset/table/batchAdd'
,
tables
,
response
=>
{
this
.
$store
.
commit
(
'setSceneData'
,
new
Date
().
getTime
());
this
.
cancel
();
});
},
cancel
()
{
this
.
dataReset
();
this
.
$router
.
push
(
"/dataset/home"
);
},
dataReset
()
{
this
.
searchTable
=
''
;
this
.
options
=
[];
this
.
dataSource
=
''
;
this
.
tables
=
[];
this
.
checkTableList
=
[];
}
},
watch
:
{
dataSource
(
val
)
{
if
(
val
)
{
this
.
$post
(
"/datasource/getTables"
,
{
id
:
val
},
response
=>
{
this
.
tables
=
response
.
data
;
}
)
}
}
},
}
</
script
>
<
style
scoped
>
.el-divider--horizontal
{
margin
:
12px
0
;
}
.form-item
{
margin-bottom
:
6px
;
}
.el-checkbox
{
margin-bottom
:
14px
;
margin-left
:
0
;
margin-right
:
14px
;
}
.el-checkbox.is-bordered
+
.el-checkbox.is-bordered
{
margin-left
:
0
;
}
</
style
>
frontend/src/business/components/chart/data/ChartHome.vue
0 → 100644
浏览文件 @
ccaa6a27
<
template
>
<el-col
style=
"height: 100%;"
>
<el-row
style=
"height: 100%;"
class=
"custom-position"
>
{{
$t
(
'chart.pls_slc_tbl_left'
)
}}
</el-row>
</el-col>
</
template
>
<
script
>
export
default
{
name
:
"ChartHome"
}
</
script
>
<
style
scoped
>
.custom-position
{
flex
:
1
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
font-size
:
14px
;
flex-flow
:
row
nowrap
;
color
:
#9ea6b2
;
}
</
style
>
frontend/src/business/components/chart/data/TabDataPreview.vue
0 → 100644
浏览文件 @
ccaa6a27
<
template
>
<el-col>
<el-table
size=
"mini"
:data=
"data"
border
style=
"width: 100%;"
>
<el-table-column
width=
"180px"
v-for=
"field in fields"
:key=
"field.fieldName"
:prop=
"field.fieldName"
:label=
"field.fieldName"
>
</el-table-column>
</el-table>
</el-col>
</
template
>
<
script
>
export
default
{
props
:
{
table
:
Object
,
fields
:
Array
,
data
:
Array
},
name
:
"TabDataPreview"
,
data
()
{
return
{
tableData
:
[{
date
:
'2016-05-02'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1518 弄'
},
{
date
:
'2016-05-04'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1517 弄'
},
{
date
:
'2016-05-01'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1519 弄'
},
{
date
:
'2016-05-03'
,
name
:
'王小虎'
,
address
:
'上海市普陀区金沙江路 1516 弄'
}]
}
},
computed
:
{},
created
()
{
},
mounted
()
{
},
activated
()
{
},
methods
:
{},
watch
:
{}
}
</
script
>
<
style
scoped
>
</
style
>
frontend/src/business/components/chart/data/ViewTable.vue
0 → 100644
浏览文件 @
ccaa6a27
<
template
>
<el-col>
<el-row>
<el-row
style=
"height: 26px;"
>
<span
v-show=
"false"
>
{{
tableId
}}
</span>
<span
style=
"line-height: 26px;"
>
{{
table
.
name
}}
</span>
<el-row
style=
"float: right"
>
<el-button
size=
"mini"
>
{{
$t
(
'dataset.edit'
)
}}
</el-button>
<el-button
size=
"mini"
>
{{
$t
(
'dataset.create_view'
)
}}
</el-button>
</el-row>
</el-row>
<el-divider/>
<el-tabs
v-model=
"tabActive"
>
<el-tab-pane
:label=
"$t('dataset.data_preview')"
name=
"dataPreview"
>
<tab-data-preview
:table=
"table"
:fields=
"fields"
:data=
"data"
/>
</el-tab-pane>
<el-tab-pane
label=
"tab2"
name=
"tab2"
>
tab2
</el-tab-pane>
<el-tab-pane
label=
"tab3"
name=
"tab3"
>
tab3
</el-tab-pane>
<el-tab-pane
label=
"tab4"
name=
"tab4"
>
tab4
</el-tab-pane>
</el-tabs>
</el-row>
</el-col>
</
template
>
<
script
>
import
TabDataPreview
from
"./TabDataPreview"
;
export
default
{
name
:
"ViewTable"
,
components
:
{
TabDataPreview
},
data
()
{
return
{
table
:
{
name
:
''
},
fields
:
[],
data
:
[],
tabActive
:
'dataPreview'
,
}
},
computed
:
{
tableId
()
{
console
.
log
(
this
.
$store
.
state
.
dataset
.
table
);
this
.
initTable
(
this
.
$store
.
state
.
dataset
.
table
);
return
this
.
$store
.
state
.
dataset
.
table
;
}
},
created
()
{
this
.
resetTable
();
},
mounted
()
{
this
.
resetTable
();
},
activated
()
{
this
.
resetTable
();
},
methods
:
{
initTable
(
id
)
{
if
(
id
!==
null
)
{
this
.
fields
=
[];
this
.
data
=
[];
this
.
$post
(
'/dataset/table/get/'
+
id
,
null
,
response
=>
{
this
.
table
=
response
.
data
;
this
.
initPreviewData
();
})
}
},
initPreviewData
()
{
if
(
this
.
table
.
id
)
{
this
.
$post
(
'/dataset/table/getPreviewData'
,
this
.
table
,
response
=>
{
this
.
fields
=
response
.
data
.
fields
;
this
.
data
=
response
.
data
.
data
;
});
}
},
initTableFields
()
{
if
(
this
.
table
.
id
)
{
this
.
$post
(
'/dataset/table/getFields'
,
this
.
table
,
response
=>
{
});
}
},
initTableData
()
{
if
(
this
.
table
.
id
)
{
this
.
$post
(
'/dataset/table/getData'
,
this
.
table
,
response
=>
{
});
}
},
resetTable
()
{
this
.
table
=
{
name
:
''
}
}
},
watch
:
{}
}
</
script
>
<
style
scoped
>
.el-divider--horizontal
{
margin
:
12px
0
;
}
.form-item
{
margin-bottom
:
6px
;
}
</
style
>
frontend/src/business/components/chart/group/Group.vue
0 → 100644
浏览文件 @
ccaa6a27
差异被折叠。
点击展开。
frontend/src/business/components/chart/router.js
0 → 100644
浏览文件 @
ccaa6a27
const
Chart
=
()
=>
import
(
'@/business/components/chart/Chart'
);
const
ChartHome
=
()
=>
import
(
'@/business/components/chart/data/ChartHome'
);
export
default
{
path
:
"/chart"
,
name
:
"ChartGroup"
,
redirect
:
"/chart/home"
,
components
:
{
content
:
Chart
,
},
children
:
[
{
path
:
'home'
,
name
:
'home'
,
component
:
ChartHome
,
}
]
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论