Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
datax-cloud
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄营
datax-cloud
Commits
5c68bd21
Commit
5c68bd21
authored
Sep 22, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
2cd112c5
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
1889 additions
and
53 deletions
+1889
-53
DataFlowBaseEntity.java
...rc/main/java/cn/datax/common/base/DataFlowBaseEntity.java
+2
-1
RedisConstant.java
...ore/src/main/java/cn/datax/common/core/RedisConstant.java
+2
-0
MsgFormatUtil.java
...re/src/main/java/cn/datax/common/utils/MsgFormatUtil.java
+55
-0
SecurityUtil.java
...ore/src/main/java/cn/datax/common/utils/SecurityUtil.java
+26
-0
ModelEntity.java
...datax/service/data/masterdata/api/entity/ModelEntity.java
+2
-1
ModelVo.java
...java/cn/datax/service/data/masterdata/api/vo/ModelVo.java
+2
-0
pom.xml
...masterdata-service-parent/data-masterdata-service/pom.xml
+5
-0
DataxMasterdataApplication.java
...x/service/data/masterdata/DataxMasterdataApplication.java
+1
-1
ModelController.java
...x/service/data/masterdata/controller/ModelController.java
+11
-0
ModelService.java
...n/datax/service/data/masterdata/service/ModelService.java
+2
-0
ModelServiceImpl.java
...ervice/data/masterdata/service/impl/ModelServiceImpl.java
+44
-0
ModelMapper.xml
...terdata-service/src/main/resources/mapper/ModelMapper.xml
+3
-1
MetadataTreeVo.java
...cn/datax/service/data/metadata/api/vo/MetadataTreeVo.java
+2
-0
MetadataColumnServiceImpl.java
...data/metadata/service/impl/MetadataColumnServiceImpl.java
+23
-18
MenuController.java
...va/cn/datax/service/system/controller/MenuController.java
+15
-0
PostController.java
...va/cn/datax/service/system/controller/PostController.java
+4
-2
RoleController.java
...va/cn/datax/service/system/controller/RoleController.java
+4
-1
BusinessDto.java
...n/java/cn/datax/service/workflow/api/dto/BusinessDto.java
+48
-0
BusinessEntity.java
.../cn/datax/service/workflow/api/entity/BusinessEntity.java
+49
-0
BusinessQuery.java
...va/cn/datax/service/workflow/api/query/BusinessQuery.java
+23
-0
BusinessVo.java
...ain/java/cn/datax/service/workflow/api/vo/BusinessVo.java
+31
-0
StartedUpRunner.java
...ava/cn/datax/service/workflow/config/StartedUpRunner.java
+26
-0
BusinessController.java
...datax/service/workflow/controller/BusinessController.java
+145
-0
BusinessDao.java
.../main/java/cn/datax/service/workflow/dao/BusinessDao.java
+18
-0
SubmitCompleteTaskListener.java
...service/workflow/flowable/SubmitCompleteTaskListener.java
+0
-1
BusinessMapper.java
...a/cn/datax/service/workflow/mapstruct/BusinessMapper.java
+20
-0
BusinessService.java
...va/cn/datax/service/workflow/service/BusinessService.java
+30
-0
BusinessServiceImpl.java
...ax/service/workflow/service/impl/BusinessServiceImpl.java
+97
-0
FlowInstanceServiceImpl.java
...ervice/workflow/service/impl/FlowInstanceServiceImpl.java
+0
-1
BusinessMapper.xml
...flow-service/src/main/resources/mapper/BusinessMapper.xml
+34
-0
datamodel.js
datax-ui/src/api/masterdata/datamodel.js
+7
-0
datacolumn.js
datax-ui/src/api/metadata/datacolumn.js
+8
-8
menu.js
datax-ui/src/api/system/menu.js
+8
-0
business.js
datax-ui/src/api/workflow/business.js
+46
-0
RoleDetail.vue
datax-ui/src/views/basic/system/role/RoleDetail.vue
+0
-18
DataPermissionList.vue
.../src/views/metadata/datapermission/DataPermissionList.vue
+194
-0
index.vue
datax-ui/src/views/metadata/datapermission/index.vue
+33
-0
BusinessAdd.vue
datax-ui/src/views/workflow/business/BusinessAdd.vue
+159
-0
BusinessDetail.vue
datax-ui/src/views/workflow/business/BusinessDetail.vue
+118
-0
BusinessEdit.vue
datax-ui/src/views/workflow/business/BusinessEdit.vue
+169
-0
BusinessList.vue
datax-ui/src/views/workflow/business/BusinessList.vue
+375
-0
index.vue
datax-ui/src/views/workflow/business/index.vue
+48
-0
No files found.
datax-common/datax-common-core/src/main/java/cn/datax/common/base/DataFlowBaseEntity.java
View file @
5c68bd21
...
...
@@ -12,7 +12,7 @@ public abstract class DataFlowBaseEntity extends DataScopeBaseEntity {
private
static
final
long
serialVersionUID
=
1L
;
/**
* 工作流状态
* 工作流状态
(1待提交,2已退回,3审核中,4通过,5不通过,6已撤销)
*/
@TableField
(
value
=
"flow_status"
,
fill
=
FieldFill
.
INSERT
)
private
String
flowStatus
;
...
...
@@ -20,5 +20,6 @@ public abstract class DataFlowBaseEntity extends DataScopeBaseEntity {
/**
* 流程实例ID
*/
@TableField
(
value
=
"process_instance_id"
)
private
String
processInstanceId
;
}
datax-common/datax-common-core/src/main/java/cn/datax/common/core/RedisConstant.java
View file @
5c68bd21
...
...
@@ -19,4 +19,6 @@ public interface RedisConstant {
String
VISUAL_SET_KEY
=
"data:visual:sets"
;
String
STANDARD_DICT_KEY
=
"data:standard:dicts"
;
String
WORKFLOW_BUSINESS_KEY
=
"data:workflow:business"
;
}
datax-common/datax-common-core/src/main/java/cn/datax/common/utils/MsgFormatUtil.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
common
.
utils
;
import
cn.hutool.core.util.StrUtil
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 消息模板格式化
*/
public
class
MsgFormatUtil
{
private
static
String
REGEX
=
"(\\{([a-zA-Z]+)\\})"
;
public
static
String
TEMPALTE_NICKNAME
=
"nickname"
;
public
static
String
TEMPALTE_DATETIME
=
"datetime"
;
public
static
String
TEMPALTE_BUSINESS_NAME
=
"businessName"
;
public
static
String
TEMPALTE_BUSINESS_KEY
=
"businessKey"
;
/**
* 根据模板及参数获得内容
* @param tempalte
* @param parameters
* @return
*/
public
static
String
getContent
(
String
tempalte
,
Map
<
String
,
String
>
parameters
)
{
if
(
StrUtil
.
isBlank
(
tempalte
))
{
tempalte
=
"业务名称:{businessName},发起人:{nickname},业务编号:{businessKey}"
;
}
Pattern
p
=
Pattern
.
compile
(
REGEX
);
Matcher
m
=
p
.
matcher
(
tempalte
);
StringBuffer
stringBuffer
=
new
StringBuffer
();
while
(
m
.
find
()){
String
key
=
m
.
group
(
2
);
String
value
=
null
;
if
(
parameters
.
containsKey
(
key
)){
value
=
parameters
.
get
(
key
);
}
value
=
(
value
==
null
)
?
""
:
value
;
m
.
appendReplacement
(
stringBuffer
,
value
);
}
m
.
appendTail
(
stringBuffer
);
return
stringBuffer
.
toString
();
}
public
static
void
main
(
String
[]
args
)
{
String
tempalte
=
"{name}你好,今年{age}岁"
;
Map
<
String
,
String
>
parameters
=
new
HashMap
<>();
parameters
.
put
(
"name"
,
"chris"
);
parameters
.
put
(
"age"
,
"22"
);
System
.
out
.
println
(
getContent
(
tempalte
,
parameters
));
}
}
datax-common/datax-common-core/src/main/java/cn/datax/common/utils/SecurityUtil.java
View file @
5c68bd21
...
...
@@ -67,6 +67,19 @@ public class SecurityUtil {
}
/**
* 获取用户昵称
*
* @return nickname
*/
public
static
String
getNickname
()
{
DataUser
user
=
getDataUser
();
if
(
user
!=
null
){
return
user
.
getNickname
();
}
return
""
;
}
/**
* 获取用户角色
*
* @return username
...
...
@@ -79,4 +92,17 @@ public class SecurityUtil {
}
return
null
;
}
/**
* 获取用户
*
* @return user
*/
public
static
boolean
isAdmin
()
{
DataUser
user
=
getDataUser
();
if
(
user
!=
null
){
return
user
.
isAdmin
();
}
return
false
;
}
}
datax-modules/data-masterdata-service-parent/data-masterdata-service-api/src/main/java/cn/datax/service/data/masterdata/api/entity/ModelEntity.java
View file @
5c68bd21
package
cn
.
datax
.
service
.
data
.
masterdata
.
api
.
entity
;
import
cn.datax.common.base.DataFlowBaseEntity
;
import
cn.datax.common.base.DataScopeBaseEntity
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
...
...
@@ -21,7 +22,7 @@ import java.util.List;
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
value
=
"masterdata_model"
,
resultMap
=
"BaseResultMap"
)
public
class
ModelEntity
extends
Data
Scope
BaseEntity
{
public
class
ModelEntity
extends
Data
Flow
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
datax-modules/data-masterdata-service-parent/data-masterdata-service-api/src/main/java/cn/datax/service/data/masterdata/api/vo/ModelVo.java
View file @
5c68bd21
...
...
@@ -28,5 +28,7 @@ public class ModelVo implements Serializable {
private
String
modelLogicTable
;
private
String
modelPhysicalTable
;
private
String
isSync
;
private
String
flowStatus
;
private
String
processInstanceId
;
private
List
<
ModelColumnVo
>
modelColumns
;
}
datax-modules/data-masterdata-service-parent/data-masterdata-service/pom.xml
View file @
5c68bd21
...
...
@@ -74,6 +74,11 @@
<artifactId>
data-standard-service-api
</artifactId>
<version>
2.0.0
</version>
</dependency>
<dependency>
<groupId>
cn.datax
</groupId>
<artifactId>
workflow-service-api
</artifactId>
<version>
2.0.0
</version>
</dependency>
</dependencies>
<build>
...
...
datax-modules/data-masterdata-service-parent/data-masterdata-service/src/main/java/cn/datax/service/data/masterdata/DataxMasterdataApplication.java
View file @
5c68bd21
...
...
@@ -4,7 +4,7 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.cloud.client.SpringCloudApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
@EnableFeignClients
(
basePackages
=
{
"cn.datax.service.system.api.feign"
})
@EnableFeignClients
(
basePackages
=
{
"cn.datax.service.system.api.feign"
,
"cn.datax.service.workflow.api.feign"
})
@SpringCloudApplication
public
class
DataxMasterdataApplication
{
...
...
datax-modules/data-masterdata-service-parent/data-masterdata-service/src/main/java/cn/datax/service/data/masterdata/controller/ModelController.java
View file @
5c68bd21
...
...
@@ -147,6 +147,17 @@ public class ModelController extends BaseController {
return
R
.
ok
();
}
/**
* 工作流提交
* @param id
* @return
*/
@PostMapping
(
"/submit/{id}"
)
public
R
submitModelById
(
@PathVariable
String
id
)
{
modelService
.
submitModelById
(
id
);
return
R
.
ok
();
}
@PostMapping
(
"/table/create/{id}"
)
public
R
createTable
(
@PathVariable
String
id
)
{
modelService
.
createTable
(
id
);
...
...
datax-modules/data-masterdata-service-parent/data-masterdata-service/src/main/java/cn/datax/service/data/masterdata/service/ModelService.java
View file @
5c68bd21
...
...
@@ -34,4 +34,6 @@ public interface ModelService extends BaseService<ModelEntity> {
Map
<
String
,
Object
>
getTableParamById
(
String
id
);
Map
<
String
,
Object
>
getFormParamById
(
String
id
);
void
submitModelById
(
String
id
);
}
datax-modules/data-masterdata-service-parent/data-masterdata-service/src/main/java/cn/datax/service/data/masterdata/service/impl/ModelServiceImpl.java
View file @
5c68bd21
...
...
@@ -4,6 +4,8 @@ import cn.datax.common.core.DataConstant;
import
cn.datax.common.core.RedisConstant
;
import
cn.datax.common.exception.DataException
;
import
cn.datax.common.redis.service.RedisService
;
import
cn.datax.common.utils.MsgFormatUtil
;
import
cn.datax.common.utils.SecurityUtil
;
import
cn.datax.service.data.masterdata.api.entity.ModelColumnEntity
;
import
cn.datax.service.data.masterdata.api.entity.ModelEntity
;
import
cn.datax.service.data.masterdata.api.dto.ModelDto
;
...
...
@@ -14,6 +16,10 @@ import cn.datax.service.data.masterdata.service.ModelService;
import
cn.datax.service.data.masterdata.dao.ModelDao
;
import
cn.datax.common.base.BaseServiceImpl
;
import
cn.datax.service.data.standard.api.entity.DictEntity
;
import
cn.datax.service.workflow.api.dto.ProcessInstanceCreateRequest
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
cn.datax.service.workflow.api.feign.FlowInstanceServiceFeign
;
import
cn.datax.service.workflow.api.vo.FlowInstanceVo
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
...
...
@@ -24,6 +30,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -57,9 +64,14 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp
@Autowired
private
RedisService
redisService
;
@Autowired
private
FlowInstanceServiceFeign
flowInstanceServiceFeign
;
private
static
String
BIND_GB_CODE
=
"gb_code"
;
private
static
String
BIND_GB_NAME
=
"gb_name"
;
private
static
String
DEFAULT_BUSINESS_CODE
=
"6011"
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ModelEntity
saveModel
(
ModelDto
modelDto
)
{
...
...
@@ -222,4 +234,36 @@ public class ModelServiceImpl extends BaseServiceImpl<ModelDao, ModelEntity> imp
map
.
put
(
"columnList"
,
columnList
);
return
map
;
}
@Override
public
void
submitModelById
(
String
id
)
{
BusinessEntity
businessEntity
=
(
BusinessEntity
)
redisService
.
hget
(
RedisConstant
.
WORKFLOW_BUSINESS_KEY
,
DEFAULT_BUSINESS_CODE
);
if
(
businessEntity
!=
null
)
{
ProcessInstanceCreateRequest
request
=
new
ProcessInstanceCreateRequest
();
request
.
setSubmitter
(
SecurityUtil
.
getUserId
());
request
.
setBusinessKey
(
id
);
request
.
setBusinessCode
(
DEFAULT_BUSINESS_CODE
);
String
processDefinitionId
=
businessEntity
.
getProcessDefinitionId
();
request
.
setProcessDefinitionId
(
processDefinitionId
);
// 流程实例标题(动态拼接)
String
tempalte
=
businessEntity
.
getBusinessTempalte
();
String
businessName
=
businessEntity
.
getBusinessName
();
Map
<
String
,
String
>
parameters
=
new
HashMap
<>();
parameters
.
put
(
MsgFormatUtil
.
TEMPALTE_NICKNAME
,
SecurityUtil
.
getNickname
());
parameters
.
put
(
MsgFormatUtil
.
TEMPALTE_DATETIME
,
DateUtil
.
formatLocalDateTime
(
LocalDateTime
.
now
()));
parameters
.
put
(
MsgFormatUtil
.
TEMPALTE_BUSINESS_NAME
,
businessName
);
parameters
.
put
(
MsgFormatUtil
.
TEMPALTE_BUSINESS_KEY
,
id
);
String
content
=
MsgFormatUtil
.
getContent
(
tempalte
,
parameters
);
request
.
setBusinessName
(
content
);
FlowInstanceVo
flowInstanceVo
=
flowInstanceServiceFeign
.
startById
(
request
);
if
(
flowInstanceVo
!=
null
)
{
ModelEntity
modelEntity
=
new
ModelEntity
();
modelEntity
.
setId
(
id
);
modelEntity
.
setProcessInstanceId
(
flowInstanceVo
.
getProcessInstanceId
());
modelDao
.
updateById
(
modelEntity
);
}
}
else
{
throw
new
DataException
(
"业务流程未配置"
);
}
}
}
datax-modules/data-masterdata-service-parent/data-masterdata-service/src/main/resources/mapper/ModelMapper.xml
View file @
5c68bd21
...
...
@@ -16,6 +16,8 @@
<result
column=
"model_logic_table"
property=
"modelLogicTable"
/>
<result
column=
"model_physical_table"
property=
"modelPhysicalTable"
/>
<result
column=
"is_sync"
property=
"isSync"
/>
<result
column=
"flow_status"
property=
"flowStatus"
/>
<result
column=
"process_instance_id"
property=
"processInstanceId"
/>
</resultMap>
<resultMap
id=
"ExtendResultMap"
type=
"cn.datax.service.data.masterdata.api.entity.ModelEntity"
extends=
"BaseResultMap"
>
...
...
@@ -32,7 +34,7 @@
update_by,
update_time,
remark,
model_name, model_logic_table, model_physical_table, is_sync
model_name, model_logic_table, model_physical_table, is_sync
, flow_status, process_instance_id
</sql>
<select
id=
"getModelColumnList"
resultType=
"cn.datax.service.data.masterdata.api.entity.ModelColumnEntity"
>
...
...
datax-modules/data-metadata-service-parent/data-metadata-service-api/src/main/java/cn/datax/service/data/metadata/api/vo/MetadataTreeVo.java
View file @
5c68bd21
...
...
@@ -16,5 +16,7 @@ public class MetadataTreeVo implements Serializable {
*/
private
String
type
;
private
String
label
;
private
String
name
;
private
String
code
;
private
List
<
MetadataTreeVo
>
children
;
}
datax-modules/data-metadata-service-parent/data-metadata-service/src/main/java/cn/datax/service/data/metadata/service/impl/MetadataColumnServiceImpl.java
View file @
5c68bd21
...
...
@@ -89,15 +89,16 @@ public class MetadataColumnServiceImpl extends BaseServiceImpl<MetadataColumnDao
stream
=
stream
.
filter
(
s
->
metadataColumnQuery
.
getSourceId
().
equals
(
s
.
getId
()));
}
List
<
MetadataTreeVo
>
list
=
stream
.
map
(
m
->
{
MetadataTreeVo
tree
=
new
MetadataTreeVo
();
tree
.
setId
(
m
.
getId
());
tree
.
setType
(
DataLevel
.
DATABASE
.
getKey
());
tree
.
setLabel
(
m
.
getSourceName
());
if
(
DataLevel
.
getLevel
(
level
).
getLevel
()
>=
DataLevel
.
TABLE
.
getLevel
())
{
tree
.
setChildren
(
getTableChildrens
(
m
.
getId
(),
level
,
metadataColumnQuery
.
getTableId
()));
}
return
tree
;
}).
collect
(
Collectors
.
toList
());
MetadataTreeVo
tree
=
new
MetadataTreeVo
();
tree
.
setId
(
m
.
getId
());
tree
.
setType
(
DataLevel
.
DATABASE
.
getKey
());
tree
.
setLabel
(
m
.
getSourceName
());
tree
.
setName
(
m
.
getSourceName
());
if
(
DataLevel
.
getLevel
(
level
).
getLevel
()
>=
DataLevel
.
TABLE
.
getLevel
())
{
tree
.
setChildren
(
getTableChildrens
(
m
.
getId
(),
level
,
metadataColumnQuery
.
getTableId
()));
}
return
tree
;
}).
collect
(
Collectors
.
toList
());
return
list
;
}
...
...
@@ -108,15 +109,17 @@ public class MetadataColumnServiceImpl extends BaseServiceImpl<MetadataColumnDao
stream
=
stream
.
filter
(
s
->
tableId
.
equals
(
s
.
getId
()));
}
List
<
MetadataTreeVo
>
children
=
stream
.
map
(
m
->
{
MetadataTreeVo
tree
=
new
MetadataTreeVo
();
tree
.
setId
(
m
.
getId
());
tree
.
setType
(
DataLevel
.
TABLE
.
getKey
());
tree
.
setLabel
(
StrUtil
.
isBlank
(
m
.
getTableComment
())
?
m
.
getTableName
()
:
m
.
getTableComment
());
if
(
DataLevel
.
getLevel
(
level
).
getLevel
()
>=
DataLevel
.
COLUMN
.
getLevel
())
{
tree
.
setChildren
(
getColumnChildrens
(
m
.
getId
()));
}
return
tree
;
}).
collect
(
Collectors
.
toList
());
MetadataTreeVo
tree
=
new
MetadataTreeVo
();
tree
.
setId
(
m
.
getId
());
tree
.
setType
(
DataLevel
.
TABLE
.
getKey
());
tree
.
setName
(
m
.
getTableComment
());
tree
.
setCode
(
m
.
getTableName
());
tree
.
setLabel
(
StrUtil
.
isBlank
(
m
.
getTableComment
())
?
m
.
getTableName
()
:
m
.
getTableComment
());
if
(
DataLevel
.
getLevel
(
level
).
getLevel
()
>=
DataLevel
.
COLUMN
.
getLevel
())
{
tree
.
setChildren
(
getColumnChildrens
(
m
.
getId
()));
}
return
tree
;
}).
collect
(
Collectors
.
toList
());
return
children
;
}
...
...
@@ -127,6 +130,8 @@ public class MetadataColumnServiceImpl extends BaseServiceImpl<MetadataColumnDao
MetadataTreeVo
tree
=
new
MetadataTreeVo
();
tree
.
setId
(
m
.
getId
());
tree
.
setType
(
DataLevel
.
TABLE
.
getKey
());
tree
.
setName
(
m
.
getColumnComment
());
tree
.
setCode
(
m
.
getColumnName
());
tree
.
setLabel
(
StrUtil
.
isBlank
(
m
.
getColumnComment
())
?
m
.
getColumnName
()
:
m
.
getColumnComment
());
return
tree
;
}).
collect
(
Collectors
.
toList
());
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/MenuController.java
View file @
5c68bd21
package
cn
.
datax
.
service
.
system
.
controller
;
import
cn.datax.common.core.DataConstant
;
import
cn.datax.common.core.R
;
import
cn.datax.common.validate.ValidationGroups
;
import
cn.datax.service.system.api.dto.MenuDto
;
import
cn.datax.service.system.api.entity.MenuEntity
;
import
cn.datax.service.system.api.entity.RoleEntity
;
import
cn.datax.service.system.api.vo.MenuVo
;
import
cn.datax.service.system.mapstruct.MenuMapper
;
import
cn.datax.service.system.service.MenuService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -82,5 +85,17 @@ public class MenuController extends BaseController {
menuService
.
deleteMenuById
(
id
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"获取工作流资源列表"
,
notes
=
""
)
@GetMapping
(
"/list/flow"
)
public
R
getMenuListForFlow
()
{
QueryWrapper
<
MenuEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"status"
,
DataConstant
.
EnableState
.
ENABLE
.
getKey
());
queryWrapper
.
eq
(
"menu_type"
,
DataConstant
.
MenuType
.
MENU
.
getKey
());
queryWrapper
.
isNotNull
(
"menu_code"
);
List
<
MenuEntity
>
list
=
menuService
.
list
(
queryWrapper
);
List
<
MenuVo
>
collect
=
list
.
stream
().
map
(
menuMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
return
R
.
ok
().
setData
(
collect
);
}
}
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/PostController.java
View file @
5c68bd21
package
cn
.
datax
.
service
.
system
.
controller
;
import
cn.datax.common.core.DataConstant
;
import
cn.datax.common.core.JsonPage
;
import
cn.datax.common.core.R
;
import
cn.datax.common.validate.ValidationGroups
;
...
...
@@ -12,7 +13,6 @@ import cn.datax.service.system.service.PostService;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -57,7 +57,9 @@ public class PostController extends BaseController {
@ApiOperation
(
value
=
"获取岗位列表"
,
notes
=
""
)
@GetMapping
(
"/list"
)
public
R
getPostList
()
{
List
<
PostEntity
>
list
=
postService
.
list
(
Wrappers
.
emptyWrapper
());
QueryWrapper
<
PostEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"status"
,
DataConstant
.
EnableState
.
ENABLE
.
getKey
());
List
<
PostEntity
>
list
=
postService
.
list
(
queryWrapper
);
List
<
PostVo
>
collect
=
list
.
stream
().
map
(
postMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
return
R
.
ok
().
setData
(
collect
);
}
...
...
datax-modules/system-service-parent/system-service/src/main/java/cn/datax/service/system/controller/RoleController.java
View file @
5c68bd21
package
cn
.
datax
.
service
.
system
.
controller
;
import
cn.datax.common.core.DataConstant
;
import
cn.datax.common.core.JsonPage
;
import
cn.datax.common.core.R
;
import
cn.datax.common.validate.ValidationGroups
;
...
...
@@ -57,7 +58,9 @@ public class RoleController extends BaseController {
@ApiOperation
(
value
=
"获取角色列表"
,
notes
=
""
)
@GetMapping
(
"/list"
)
public
R
getPostList
()
{
List
<
RoleEntity
>
list
=
roleService
.
list
(
Wrappers
.
emptyWrapper
());
QueryWrapper
<
RoleEntity
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"status"
,
DataConstant
.
EnableState
.
ENABLE
.
getKey
());
List
<
RoleEntity
>
list
=
roleService
.
list
(
queryWrapper
);
List
<
RoleVo
>
collect
=
list
.
stream
().
map
(
roleMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
return
R
.
ok
().
setData
(
collect
);
}
...
...
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/dto/BusinessDto.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
api
.
dto
;
import
cn.datax.common.validate.ValidationGroups
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
/**
* <p>
* 业务流程配置表 实体DTO
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@ApiModel
(
value
=
"业务流程配置表Model"
)
@Data
public
class
BusinessDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"主键ID"
)
@NotBlank
(
message
=
"主键ID不能为空"
,
groups
=
{
ValidationGroups
.
Update
.
class
})
private
String
id
;
@ApiModelProperty
(
value
=
"业务编码"
)
@NotBlank
(
message
=
"业务编码不能为空"
,
groups
=
{
ValidationGroups
.
Insert
.
class
,
ValidationGroups
.
Update
.
class
})
private
String
businessCode
;
@ApiModelProperty
(
value
=
"业务名称"
)
@NotBlank
(
message
=
"业务名称不能为空"
,
groups
=
{
ValidationGroups
.
Insert
.
class
,
ValidationGroups
.
Update
.
class
})
private
String
businessName
;
@ApiModelProperty
(
value
=
"业务组件"
)
@NotBlank
(
message
=
"业务组件不能为空"
,
groups
=
{
ValidationGroups
.
Insert
.
class
,
ValidationGroups
.
Update
.
class
})
private
String
businessComponent
;
@ApiModelProperty
(
value
=
"流程定义ID"
)
@NotBlank
(
message
=
"流程定义ID不能为空"
,
groups
=
{
ValidationGroups
.
Insert
.
class
,
ValidationGroups
.
Update
.
class
})
private
String
processDefinitionId
;
@ApiModelProperty
(
value
=
"消息模板"
)
@NotBlank
(
message
=
"消息模板不能为空"
,
groups
=
{
ValidationGroups
.
Insert
.
class
,
ValidationGroups
.
Update
.
class
})
private
String
businessTempalte
;
@ApiModelProperty
(
value
=
"状态"
)
@NotNull
(
message
=
"状态不能为空"
,
groups
=
{
ValidationGroups
.
Insert
.
class
,
ValidationGroups
.
Update
.
class
})
private
String
status
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/entity/BusinessEntity.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
api
.
entity
;
import
cn.datax.common.base.DataScopeBaseEntity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
/**
* <p>
* 业务流程配置表
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"flow_business"
)
public
class
BusinessEntity
extends
DataScopeBaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 业务编码
*/
private
String
businessCode
;
/**
* 业务名称
*/
private
String
businessName
;
/**
* 业务组件
*/
private
String
businessComponent
;
/**
* 流程定义ID
*/
private
String
processDefinitionId
;
/**
* 消息模板
*/
private
String
businessTempalte
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/query/BusinessQuery.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
api
.
query
;
import
cn.datax.common.base.BaseQueryParams
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* <p>
* 业务流程配置表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
BusinessQuery
extends
BaseQueryParams
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
businessCode
;
private
String
businessName
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/vo/BusinessVo.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
api
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* <p>
* 业务流程配置表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Data
public
class
BusinessVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
id
;
private
String
status
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
LocalDateTime
createTime
;
private
String
businessCode
;
private
String
businessName
;
private
String
businessComponent
;
private
String
processDefinitionId
;
private
String
businessTempalte
;
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/config/StartedUpRunner.java
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
config
;
import
cn.datax.common.core.DataConstant
;
import
cn.datax.common.core.RedisConstant
;
import
cn.datax.common.redis.service.RedisService
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
cn.datax.service.workflow.dao.BusinessDao
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.ApplicationArguments
;
import
org.springframework.boot.ApplicationRunner
;
import
org.springframework.context.ConfigurableApplicationContext
;
...
...
@@ -9,6 +16,9 @@ import org.springframework.stereotype.Component;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
@RequiredArgsConstructor
...
...
@@ -17,6 +27,12 @@ public class StartedUpRunner implements ApplicationRunner {
private
final
ConfigurableApplicationContext
context
;
private
final
Environment
environment
;
@Autowired
private
BusinessDao
businessDao
;
@Autowired
private
RedisService
redisService
;
@Override
public
void
run
(
ApplicationArguments
args
)
{
if
(
context
.
isActive
())
{
...
...
@@ -26,6 +42,16 @@ public class StartedUpRunner implements ApplicationRunner {
"端口号:"
+
environment
.
getProperty
(
"server.port"
)
+
"\n"
+
"-----------------------------------------"
;
System
.
out
.
println
(
banner
);
// 项目启动时,初始化缓存
String
businessKey
=
RedisConstant
.
WORKFLOW_BUSINESS_KEY
;
Boolean
hasBusinessKey
=
redisService
.
hasKey
(
businessKey
);
if
(!
hasBusinessKey
)
{
List
<
BusinessEntity
>
businessEntityList
=
businessDao
.
selectList
(
Wrappers
.<
BusinessEntity
>
lambdaQuery
()
.
eq
(
BusinessEntity:
:
getStatus
,
DataConstant
.
EnableState
.
ENABLE
.
getKey
()));
Map
<
String
,
Object
>
map
=
businessEntityList
.
stream
().
collect
(
Collectors
.
toMap
(
BusinessEntity:
:
getBusinessCode
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
redisService
.
hmset
(
businessKey
,
map
);
}
}
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/controller/BusinessController.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
controller
;
import
cn.datax.common.core.JsonPage
;
import
cn.datax.common.core.R
;
import
cn.datax.common.validate.ValidationGroups
;
import
cn.datax.service.workflow.api.dto.BusinessDto
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
cn.datax.service.workflow.api.vo.BusinessVo
;
import
cn.datax.service.workflow.api.query.BusinessQuery
;
import
cn.datax.service.workflow.mapstruct.BusinessMapper
;
import
cn.datax.service.workflow.service.BusinessService
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
cn.datax.common.base.BaseController
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>
* 业务流程配置表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Api
(
tags
=
{
"业务流程配置表"
})
@RestController
@RequestMapping
(
"/business"
)
public
class
BusinessController
extends
BaseController
{
@Autowired
private
BusinessService
businessService
;
@Autowired
private
BusinessMapper
businessMapper
;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation
(
value
=
"获取详细信息"
,
notes
=
"根据url的id来获取详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getBusinessById
(
@PathVariable
String
id
)
{
BusinessEntity
businessEntity
=
businessService
.
getBusinessById
(
id
);
return
R
.
ok
().
setData
(
businessMapper
.
toVO
(
businessEntity
));
}
/**
* 分页查询信息
*
* @param businessQuery
* @return
*/
@ApiOperation
(
value
=
"分页查询"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"businessQuery"
,
value
=
"查询实体businessQuery"
,
required
=
true
,
dataTypeClass
=
BusinessQuery
.
class
)
})
@GetMapping
(
"/page"
)
public
R
getBusinessPage
(
BusinessQuery
businessQuery
)
{
QueryWrapper
<
BusinessEntity
>
queryWrapper
=
new
QueryWrapper
<>();
IPage
<
BusinessEntity
>
page
=
businessService
.
page
(
new
Page
<>(
businessQuery
.
getPageNum
(),
businessQuery
.
getPageSize
()),
queryWrapper
);
List
<
BusinessVo
>
collect
=
page
.
getRecords
().
stream
().
map
(
businessMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
JsonPage
<
BusinessVo
>
jsonPage
=
new
JsonPage
<>(
page
.
getCurrent
(),
page
.
getSize
(),
page
.
getTotal
(),
collect
);
return
R
.
ok
().
setData
(
jsonPage
);
}
/**
* 添加
* @param business
* @return
*/
@ApiOperation
(
value
=
"添加信息"
,
notes
=
"根据business对象添加信息"
)
@ApiImplicitParam
(
name
=
"business"
,
value
=
"详细实体business"
,
required
=
true
,
dataType
=
"BusinessDto"
)
@PostMapping
()
public
R
saveBusiness
(
@RequestBody
@Validated
({
ValidationGroups
.
Insert
.
class
})
BusinessDto
business
)
{
BusinessEntity
businessEntity
=
businessService
.
saveBusiness
(
business
);
return
R
.
ok
().
setData
(
businessMapper
.
toVO
(
businessEntity
));
}
/**
* 修改
* @param business
* @return
*/
@ApiOperation
(
value
=
"修改信息"
,
notes
=
"根据url的id来指定修改对象,并根据传过来的信息来修改详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"business"
,
value
=
"详细实体business"
,
required
=
true
,
dataType
=
"BusinessDto"
)
})
@PutMapping
(
"/{id}"
)
public
R
updateBusiness
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidationGroups
.
Update
.
class
})
BusinessDto
business
)
{
BusinessEntity
businessEntity
=
businessService
.
updateBusiness
(
business
);
return
R
.
ok
().
setData
(
businessMapper
.
toVO
(
businessEntity
));
}
/**
* 删除
* @param id
* @return
*/
@ApiOperation
(
value
=
"删除"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deleteBusinessById
(
@PathVariable
String
id
)
{
businessService
.
deleteBusinessById
(
id
);
return
R
.
ok
();
}
/**
* 批量删除
* @param ids
* @return
*/
@ApiOperation
(
value
=
"批量删除角色"
,
notes
=
"根据url的ids来批量删除对象"
)
@ApiImplicitParam
(
name
=
"ids"
,
value
=
"ID集合"
,
required
=
true
,
dataType
=
"List"
,
paramType
=
"path"
)
@DeleteMapping
(
"/batch/{ids}"
)
public
R
deleteBusinessBatch
(
@PathVariable
List
<
String
>
ids
)
{
businessService
.
deleteBusinessBatch
(
ids
);
return
R
.
ok
();
}
/**
* 刷新缓存
*
* @return
*/
@GetMapping
(
"/refresh"
)
public
R
refreshBusiness
()
{
businessService
.
refreshBusiness
();
return
R
.
ok
();
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/dao/BusinessDao.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
dao
;
import
cn.datax.common.base.BaseDao
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* <p>
* 业务流程配置表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Mapper
public
interface
BusinessDao
extends
BaseDao
<
BusinessEntity
>
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/flowable/SubmitCompleteTaskListener.java
View file @
5c68bd21
...
...
@@ -22,7 +22,6 @@ public class SubmitCompleteTaskListener implements TaskListener {
// 发送消息队列
String
businessKey
=
(
String
)
variables
.
get
(
VariablesEnum
.
businessKey
.
toString
());
String
businessCode
=
(
String
)
variables
.
get
(
VariablesEnum
.
businessCode
.
toString
());
// 删除审核参数
log
.
info
(
"业务审核中:{},{}"
,
businessKey
,
businessCode
);
log
.
info
(
"业务审核中状态:{}"
,
DataConstant
.
AuditState
.
AUDIT
.
getKey
());
log
.
info
(
"退出提交节点用户任务完成监听器"
);
...
...
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/mapstruct/BusinessMapper.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
mapstruct
;
import
cn.datax.common.mapstruct.EntityMapper
;
import
cn.datax.service.workflow.api.dto.BusinessDto
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
cn.datax.service.workflow.api.vo.BusinessVo
;
import
org.mapstruct.Mapper
;
/**
* <p>
* 业务流程配置表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Mapper
(
componentModel
=
"spring"
)
public
interface
BusinessMapper
extends
EntityMapper
<
BusinessDto
,
BusinessEntity
,
BusinessVo
>
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/BusinessService.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
service
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
cn.datax.service.workflow.api.dto.BusinessDto
;
import
cn.datax.common.base.BaseService
;
import
java.util.List
;
/**
* <p>
* 业务流程配置表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
public
interface
BusinessService
extends
BaseService
<
BusinessEntity
>
{
BusinessEntity
saveBusiness
(
BusinessDto
business
);
BusinessEntity
updateBusiness
(
BusinessDto
business
);
BusinessEntity
getBusinessById
(
String
id
);
void
deleteBusinessById
(
String
id
);
void
deleteBusinessBatch
(
List
<
String
>
ids
);
void
refreshBusiness
();
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/impl/BusinessServiceImpl.java
0 → 100644
View file @
5c68bd21
package
cn
.
datax
.
service
.
workflow
.
service
.
impl
;
import
cn.datax.common.core.DataConstant
;
import
cn.datax.common.core.RedisConstant
;
import
cn.datax.common.exception.DataException
;
import
cn.datax.common.redis.service.RedisService
;
import
cn.datax.service.workflow.api.entity.BusinessEntity
;
import
cn.datax.service.workflow.api.dto.BusinessDto
;
import
cn.datax.service.workflow.service.BusinessService
;
import
cn.datax.service.workflow.mapstruct.BusinessMapper
;
import
cn.datax.service.workflow.dao.BusinessDao
;
import
cn.datax.common.base.BaseServiceImpl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* <p>
* 业务流程配置表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-22
*/
@Service
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
BusinessServiceImpl
extends
BaseServiceImpl
<
BusinessDao
,
BusinessEntity
>
implements
BusinessService
{
@Autowired
private
BusinessDao
businessDao
;
@Autowired
private
BusinessMapper
businessMapper
;
@Autowired
private
RedisService
redisService
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
BusinessEntity
saveBusiness
(
BusinessDto
businessDto
)
{
BusinessEntity
business
=
businessMapper
.
toEntity
(
businessDto
);
int
n
=
businessDao
.
selectCount
(
Wrappers
.<
BusinessEntity
>
lambdaQuery
().
eq
(
BusinessEntity:
:
getBusinessCode
,
business
.
getBusinessCode
()));
if
(
n
>
0
){
throw
new
DataException
(
"该业务编码已存在"
);
}
businessDao
.
insert
(
business
);
return
business
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
BusinessEntity
updateBusiness
(
BusinessDto
businessDto
)
{
BusinessEntity
business
=
businessMapper
.
toEntity
(
businessDto
);
businessDao
.
updateById
(
business
);
return
business
;
}
@Override
public
BusinessEntity
getBusinessById
(
String
id
)
{
BusinessEntity
businessEntity
=
super
.
getById
(
id
);
return
businessEntity
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteBusinessById
(
String
id
)
{
businessDao
.
deleteById
(
id
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteBusinessBatch
(
List
<
String
>
ids
)
{
businessDao
.
deleteBatchIds
(
ids
);
}
@Override
public
void
refreshBusiness
()
{
String
key
=
RedisConstant
.
WORKFLOW_BUSINESS_KEY
;
Boolean
hasKey
=
redisService
.
hasKey
(
key
);
if
(
hasKey
)
{
redisService
.
del
(
key
);
}
List
<
BusinessEntity
>
businessEntityList
=
businessDao
.
selectList
(
Wrappers
.<
BusinessEntity
>
lambdaQuery
()
.
eq
(
BusinessEntity:
:
getStatus
,
DataConstant
.
EnableState
.
ENABLE
.
getKey
()));
// 第一个参数BusinessEntity::getBusinessCode 表示选择BusinessEntity的businessCode作为map的key值
// 第二个参数v -> v表示选择将原来的对象作为map的value值
// 第三个参数(v1, v2) -> v2中,如果v1与v2的key值相同,选择v2作为那个key所对应的value值
Map
<
String
,
Object
>
map
=
businessEntityList
.
stream
().
collect
(
Collectors
.
toMap
(
BusinessEntity:
:
getBusinessCode
,
v
->
v
,
(
v1
,
v2
)
->
v2
));
redisService
.
hmset
(
key
,
map
);
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/impl/FlowInstanceServiceImpl.java
View file @
5c68bd21
...
...
@@ -125,7 +125,6 @@ public class FlowInstanceServiceImpl implements FlowInstanceService {
if
(
StrUtil
.
isNotBlank
(
request
.
getBusinessKey
())){
processInstanceBuilder
.
businessKey
(
request
.
getBusinessKey
());
}
// 流程实例标题(动态拼接)
if
(
StrUtil
.
isNotBlank
(
request
.
getBusinessName
())){
processInstanceBuilder
.
name
(
request
.
getBusinessName
());
}
...
...
datax-modules/workflow-service-parent/workflow-service/src/main/resources/mapper/BusinessMapper.xml
0 → 100644
View file @
5c68bd21
<?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=
"cn.datax.service.workflow.dao.BusinessDao"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"cn.datax.service.workflow.api.entity.BusinessEntity"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"status"
property=
"status"
/>
<result
column=
"create_by"
property=
"createBy"
/>
<result
column=
"create_time"
property=
"createTime"
/>
<result
column=
"create_dept"
property=
"createDept"
/>
<result
column=
"update_by"
property=
"updateBy"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"remark"
property=
"remark"
/>
<result
column=
"business_code"
property=
"businessCode"
/>
<result
column=
"business_name"
property=
"businessName"
/>
<result
column=
"business_component"
property=
"businessComponent"
/>
<result
column=
"process_definition_id"
property=
"processDefinitionId"
/>
<result
column=
"business_tempalte"
property=
"businessTempalte"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id,
status,
create_by,
create_time,
create_dept,
update_by,
update_time,
remark, business_code, business_name, business_component, process_definition_id, business_tempalte
</sql>
</mapper>
datax-ui/src/api/masterdata/datamodel.js
View file @
5c68bd21
...
...
@@ -53,6 +53,13 @@ export function updateDataModel(data) {
})
}
export
function
submitDataModel
(
id
)
{
return
request
({
url
:
'/data/masterdata/models/submit/'
+
id
,
method
:
'post'
})
}
export
function
createTable
(
id
)
{
return
request
({
url
:
'/data/masterdata/models/table/create/'
+
id
,
...
...
datax-ui/src/api/metadata/datacolumn.js
View file @
5c68bd21
import
request
from
'@/utils/request'
export
function
listDataColumn
(
data
)
{
export
function
listDataColumn
(
data
)
{
return
request
({
url
:
'/data/metadata/columns/list'
,
method
:
'get'
,
...
...
@@ -8,7 +8,7 @@ export function listDataColumn (data) {
})
}
export
function
pageDataColumn
(
data
)
{
export
function
pageDataColumn
(
data
)
{
return
request
({
url
:
'/data/metadata/columns/page'
,
method
:
'get'
,
...
...
@@ -16,28 +16,28 @@ export function pageDataColumn (data) {
})
}
export
function
getDataColumn
(
id
)
{
export
function
getDataColumn
(
id
)
{
return
request
({
url
:
'/data/metadata/columns/'
+
id
,
method
:
'get'
})
}
export
function
delDataColumn
(
id
)
{
export
function
delDataColumn
(
id
)
{
return
request
({
url
:
'/data/metadata/columns/'
+
id
,
method
:
'delete'
})
}
export
function
delDataColumns
(
ids
)
{
export
function
delDataColumns
(
ids
)
{
return
request
({
url
:
'/data/metadata/columns/batch/'
+
ids
,
method
:
'delete'
})
}
export
function
addDataColumn
(
data
)
{
export
function
addDataColumn
(
data
)
{
return
request
({
url
:
'/data/metadata/columns'
,
method
:
'post'
,
...
...
@@ -45,7 +45,7 @@ export function addDataColumn (data) {
})
}
export
function
updateDataColumn
(
data
)
{
export
function
updateDataColumn
(
data
)
{
return
request
({
url
:
'/data/metadata/columns/'
+
data
.
id
,
method
:
'put'
,
...
...
@@ -53,7 +53,7 @@ export function updateDataColumn (data) {
})
}
export
function
getDataMetadataTree
(
level
,
data
)
{
export
function
getDataMetadataTree
(
level
,
data
)
{
return
request
({
url
:
'/data/metadata/columns/tree/'
+
level
,
method
:
'get'
,
...
...
datax-ui/src/api/system/menu.js
View file @
5c68bd21
...
...
@@ -8,6 +8,14 @@ export function listMenu (data) {
})
}
export
function
listMenuForFlow
(
data
)
{
return
request
({
url
:
'/system/menus/list/flow'
,
method
:
'get'
,
params
:
data
})
}
export
function
getMenu
(
id
)
{
return
request
({
url
:
'/system/menus/'
+
id
,
...
...
datax-ui/src/api/workflow/business.js
0 → 100644
View file @
5c68bd21
import
request
from
'@/utils/request'
export
function
refreshBusiness
()
{
return
request
({
url
:
'/workflow/business/refresh'
,
method
:
'get'
})
}
export
function
pageBusiness
(
data
)
{
return
request
({
url
:
'/workflow/business/page'
,
method
:
'get'
,
params
:
data
})
}
export
function
getBusiness
(
id
)
{
return
request
({
url
:
'/workflow/business/'
+
id
,
method
:
'get'
})
}
export
function
delBusiness
(
id
)
{
return
request
({
url
:
'/workflow/business/'
+
id
,
method
:
'delete'
})
}
export
function
addBusiness
(
data
)
{
return
request
({
url
:
'/workflow/business'
,
method
:
'post'
,
data
:
data
})
}
export
function
updateBusiness
(
data
)
{
return
request
({
url
:
'/workflow/business/'
+
data
.
id
,
method
:
'put'
,
data
:
data
})
}
datax-ui/src/views/basic/system/role/RoleDetail.vue
View file @
5c68bd21
...
...
@@ -167,24 +167,6 @@ export default {
}
})
},
// 所有菜单节点数据
getMenuAllCheckedKeys
()
{
// 目前被选中的菜单节点
const
checkedKeys
=
this
.
$refs
.
menu
.
getHalfCheckedKeys
()
// 半选中的菜单节点
const
halfCheckedKeys
=
this
.
$refs
.
menu
.
getCheckedKeys
()
checkedKeys
.
unshift
.
apply
(
checkedKeys
,
halfCheckedKeys
)
return
checkedKeys
},
// 所有部门节点数据
getDeptAllCheckedKeys
()
{
// 目前被选中的部门节点
const
checkedKeys
=
this
.
$refs
.
dept
.
getHalfCheckedKeys
()
// 半选中的部门节点
const
halfCheckedKeys
=
this
.
$refs
.
dept
.
getCheckedKeys
()
checkedKeys
.
unshift
.
apply
(
checkedKeys
,
halfCheckedKeys
)
return
checkedKeys
},
/** 获取详情 */
getRole
:
function
(
id
)
{
getRole
(
id
).
then
(
response
=>
{
...
...
datax-ui/src/views/metadata/datapermission/DataPermissionList.vue
0 → 100644
View file @
5c68bd21
<
template
>
<el-row
:gutter=
"20"
>
<el-col
:span=
"6"
>
<el-card
class=
"box-card tree-wrapper"
shadow=
"always"
>
<el-tree
ref=
"tree"
:data=
"treeOptions"
node-key=
"id"
empty-text=
"加载中,请稍后"
:props=
"defaultProps"
default-expand-all
highlight-current
:expand-on-click-node=
"false"
@
node-click=
"handleNodeClick"
>
<span
class=
"custom-tree-node"
slot-scope=
"
{ node, data }">
<span><i
v-if=
"node.level === 1"
class=
"iconfont icon-zuzhi tree-folder"
/>
{{
node
.
label
}}
</span>
</span>
</el-tree>
</el-card>
</el-col>
<el-col
:span=
"18"
>
<el-card
class=
"box-card tree-wrapper"
shadow=
"always"
>
<el-row
type=
"flex"
justify=
"space-between"
>
<el-col
:span=
"12"
>
<el-button-group>
<el-button
type=
"warning"
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"handleCacheRefresh"
>
刷新缓存
</el-button>
</el-button-group>
</el-col>
<el-col
:span=
"12"
>
<el-button-group
style=
"float: right;"
>
<template
v-if=
"showBtns"
>
<el-button
size=
"mini"
round
v-if=
"disabled"
@
click=
"disabled = false"
>
修改
</el-button>
<el-button
size=
"mini"
round
v-else
@
click=
"handSubmit"
>
保存
</el-button>
</
template
>
</el-button-group>
</el-col>
</el-row>
<el-divider></el-divider>
<el-form
ref=
"form"
:model=
"form"
:disabled=
"disabled"
>
<el-tree
ref=
"data"
:data=
"dataTreeOptions"
show-checkbox
node-key=
"id"
empty-text=
"加载中,请稍后"
:props=
"dataDefaultProps"
highlight-current
:expand-on-click-node=
"false"
:check-strictly=
"checkStrictly"
>
<span
class=
"custom-tree-node"
slot-scope=
"{ node, data }"
>
<span>
<i
v-if=
"node.level === 1"
class=
"iconfont icon-shujuku tree-folder"
/>
<i
v-else-if=
"node.level === 2"
class=
"iconfont icon-shujubiao tree-folder"
/>
<i
v-else-if=
"node.level === 3"
class=
"iconfont icon-shujuziduan tree-folder"
/>
{{ data.code ? (data.name ? data.code + '(' + data.name + ')' : data.code) : data.name }}
</span>
</span>
</el-tree>
</el-form>
</el-card>
</el-col>
</el-row>
</template>
<
script
>
import
{
listRole
}
from
'@/api/system/role'
import
{
getDataMetadataTree
,
getGrantPermission
,
grantPermission
}
from
'@/api/metadata/datacolumn'
export
default
{
name
:
'DataPermissionList'
,
data
()
{
return
{
tableHeight
:
document
.
body
.
offsetHeight
-
310
+
'px'
,
// 展示切换
showOptions
:
{
data
:
{},
showList
:
true
},
// 左侧树
treeOptions
:
[],
defaultProps
:
{
children
:
'children'
,
label
:
'roleName'
},
// 右侧树
dataTreeOptions
:
[],
dataDefaultProps
:
{
children
:
'children'
,
label
:
'label'
},
checkStrictly
:
false
,
form
:
{},
disabled
:
true
,
showBtns
:
false
,
btnSubmitEnable
:
false
}
},
created
()
{
this
.
getLeftTree
()
this
.
getRightTree
()
},
methods
:
{
getLeftTree
()
{
listRole
().
then
(
response
=>
{
if
(
response
.
success
)
{
const
{
data
}
=
response
const
tree
=
{}
tree
.
roleName
=
'角色组'
tree
.
children
=
data
this
.
treeOptions
=
[]
this
.
treeOptions
.
push
(
tree
)
}
})
},
handleNodeClick
(
data
)
{
if
(
data
.
id
)
{
this
.
form
.
roleId
=
data
.
id
getGrantPermission
(
data
.
id
).
then
(
response
=>
{
if
(
response
.
success
)
{
const
{
data
}
=
response
const
checkedKeys
=
data
||
[]
if
(
checkedKeys
&&
checkedKeys
.
length
>
0
)
{
this
.
checkStrictly
=
true
this
.
$nextTick
(()
=>
{
this
.
$refs
.
data
.
setCheckedKeys
(
checkedKeys
)
this
.
checkStrictly
=
false
})
}
this
.
showBtns
=
true
}
})
}
},
getRightTree
()
{
getDataMetadataTree
(
'column'
).
then
(
response
=>
{
if
(
response
.
success
)
{
const
{
data
}
=
response
this
.
dataTreeOptions
=
data
}
})
},
// 获取选中节点数据
getAllCheckedKeys
()
{
// 目前被选中的节点
const
checkedKeys
=
this
.
$refs
.
data
.
getHalfCheckedKeys
()
// 半选中的菜单节点
const
halfCheckedKeys
=
this
.
$refs
.
data
.
getCheckedKeys
()
checkedKeys
.
unshift
.
apply
(
checkedKeys
,
halfCheckedKeys
)
return
checkedKeys
},
handSubmit
()
{
this
.
form
.
ids
=
this
.
getAllCheckedKeys
()
grantPermission
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$message
.
success
(
'保存成功'
)
this
.
disabled
=
true
}
})
},
handleCacheRefresh
()
{}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.right-toolbar
{
float
:
right
;
}
.el-card
::v-deep
.el-card__body
{
height
:
calc
(
100vh
-
170px
);
}
.tree-wrapper
{
overflow-y
:
auto
;
::v-deep
.custom-tree-node
{
flex
:
1
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
font-size
:
14px
;
.tree-folder
{
margin-right
:
5px
;
color
:
#f6cf07
;
}
}
}
</
style
>
datax-ui/src/views/metadata/datapermission/index.vue
0 → 100644
View file @
5c68bd21
<
template
>
<div
class=
"app-container"
>
<transition
name=
"el-zoom-in-center"
>
<data-permission-list
v-if=
"options.showList"
@
showCard=
"showCard"
/>
</transition>
</div>
</
template
>
<
script
>
import
DataPermissionList
from
'./DataPermissionList'
export
default
{
name
:
'DataPermission'
,
components
:
{
DataPermissionList
},
data
()
{
return
{
options
:
{
data
:
{},
showList
:
true
}
}
},
methods
:
{
showCard
(
data
)
{
Object
.
assign
(
this
.
options
,
data
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
datax-ui/src/views/workflow/business/BusinessAdd.vue
0 → 100644
View file @
5c68bd21
<
template
>
<el-card
class=
"box-card"
shadow=
"always"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
{{
title
}}
</span>
<el-button-group
style=
"float: right;"
>
<el-button
size=
"mini"
icon=
"el-icon-plus"
round
:loading=
"loadingOptions.loading"
:disabled=
"loadingOptions.isDisabled"
@
click=
"submitForm"
>
{{
loadingOptions
.
loadingText
}}
</el-button>
<el-button
size=
"mini"
icon=
"el-icon-back"
round
@
click=
"showCard"
>
返回
</el-button>
</el-button-group>
</div>
<div
class=
"body-wrapper"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"业务编码"
prop=
"businessCode"
>
<el-select
v-model=
"form.businessCode"
clearable
filterable
@
change=
"changeValue($event)"
placeholder=
"请输入业务编码"
>
<el-option
v-for=
"item in menuOptions"
:key=
"item.menuCode"
:label=
"item.menuName"
:value=
"item.menuCode"
>
<span
style=
"float: left"
>
{{
'业务名称:'
+
item
.
menuName
+
'-业务编码:'
+
item
.
menuCode
}}
</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"流程定义ID"
prop=
"processDefinitionId"
>
<el-input
v-model=
"form.processDefinitionId"
placeholder=
"请输入流程定义ID"
/>
</el-form-item>
<el-form-item
label=
"消息模板"
prop=
"businessTempalte"
>
<el-input
v-model=
"form.businessTempalte"
type=
"textarea"
placeholder=
"请输入消息模板,模板字段
{nickname、datetime、businessName、businessKey}" />
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio
v-for=
"dict in statusOptions"
:key=
"dict.id"
:label=
"dict.itemText"
>
{{
dict
.
itemValue
}}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"form.remark"
type=
"textarea"
placeholder=
"请输入内容"
/>
</el-form-item>
</el-form>
</div>
</el-card>
</
template
>
<
script
>
import
{
addBusiness
}
from
'@/api/workflow/business'
import
{
listMenuForFlow
}
from
'@/api/system/menu'
export
default
{
name
:
'BusinessAdd'
,
props
:
{
data
:
{
type
:
Object
,
default
:
function
()
{
return
{}
}
}
},
data
()
{
return
{
title
:
'业务流程配置新增'
,
// 展示切换
showOptions
:
{
data
:
{},
showList
:
true
,
showAdd
:
false
,
showEdit
:
false
,
showDetail
:
false
},
// 保存按钮
loadingOptions
:
{
loading
:
false
,
loadingText
:
'保存'
,
isDisabled
:
false
},
// 表单参数
form
:
{
status
:
'1'
},
// 表单校验
rules
:
{
businessCode
:
[
{
required
:
true
,
message
:
'业务编码不能为空'
,
trigger
:
'blur'
}
],
processDefinitionId
:
[
{
required
:
true
,
message
:
'流程定义ID不能为空'
,
trigger
:
'blur'
}
]
},
// 状态数据字典
statusOptions
:
[],
menuOptions
:
[]
}
},
created
()
{
this
.
getDicts
(
'sys_common_status'
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
statusOptions
=
response
.
data
}
})
this
.
getMenuOptions
()
},
methods
:
{
showCard
()
{
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
getMenuOptions
()
{
listMenuForFlow
().
then
(
response
=>
{
if
(
response
.
success
)
{
const
{
data
}
=
response
this
.
menuOptions
=
data
}
})
},
changeValue
(
value
)
{
const
obj
=
this
.
menuOptions
.
find
(
function
(
item
)
{
return
item
.
menuCode
===
value
})
this
.
form
.
businessName
=
obj
.
menuName
this
.
form
.
businessComponent
=
obj
.
menuComponent
},
/** 提交按钮 */
submitForm
:
function
()
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loadingOptions
.
loading
=
true
this
.
loadingOptions
.
loadingText
=
'保存中...'
this
.
loadingOptions
.
isDisabled
=
true
addBusiness
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$message
.
success
(
'保存成功'
)
setTimeout
(()
=>
{
// 2秒后跳转列表页
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
2000
)
}
else
{
this
.
$message
.
error
(
'保存失败'
)
this
.
loadingOptions
.
loading
=
false
this
.
loadingOptions
.
loadingText
=
'保存'
this
.
loadingOptions
.
isDisabled
=
false
}
}).
catch
(()
=>
{
this
.
loadingOptions
.
loading
=
false
this
.
loadingOptions
.
loadingText
=
'保存'
this
.
loadingOptions
.
isDisabled
=
false
})
}
})
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.el-card
::v-deep
.el-card__body
{
height
:
calc
(
100vh
-
230px
);
overflow-y
:
auto
;
}
</
style
>
datax-ui/src/views/workflow/business/BusinessDetail.vue
0 → 100644
View file @
5c68bd21
<
template
>
<el-card
class=
"box-card"
shadow=
"always"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
{{
title
}}
</span>
<el-button-group
style=
"float: right;"
>
<el-button
size=
"mini"
icon=
"el-icon-back"
round
@
click=
"showCard"
>
返回
</el-button>
</el-button-group>
</div>
<div
class=
"body-wrapper"
>
<el-form
ref=
"form"
:model=
"form"
label-width=
"80px"
disabled
>
<el-form-item
label=
"业务编码"
prop=
"businessCode"
>
<el-select
v-model=
"form.businessCode"
placeholder=
"请输入业务编码"
>
<el-option
v-for=
"item in menuOptions"
:key=
"item.menuCode"
:label=
"item.menuName"
:value=
"item.menuCode"
>
<span
style=
"float: left"
>
{{
'业务名称:'
+
item
.
menuName
+
'-业务编码:'
+
item
.
menuCode
}}
</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"流程定义ID"
prop=
"processDefinitionId"
>
<el-input
v-model=
"form.processDefinitionId"
placeholder=
"请输入流程定义ID"
/>
</el-form-item>
<el-form-item
label=
"消息模板"
prop=
"businessTempalte"
>
<el-input
v-model=
"form.businessTempalte"
type=
"textarea"
placeholder=
"请输入消息模板"
/>
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio
v-for=
"dict in statusOptions"
:key=
"dict.id"
:label=
"dict.itemText"
>
{{
dict
.
itemValue
}}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"form.remark"
type=
"textarea"
placeholder=
"请输入内容"
/>
</el-form-item>
</el-form>
</div>
</el-card>
</
template
>
<
script
>
import
{
getBusiness
}
from
'@/api/workflow/business'
import
{
listMenuForFlow
}
from
'@/api/system/menu'
export
default
{
name
:
'BusinessDetail'
,
props
:
{
data
:
{
type
:
Object
,
default
:
function
()
{
return
{}
}
}
},
data
()
{
return
{
title
:
'业务流程配置详情'
,
// 展示切换
showOptions
:
{
data
:
{},
showList
:
true
,
showAdd
:
false
,
showEdit
:
false
,
showDetail
:
false
},
// 表单参数
form
:
{},
// 状态数据字典
statusOptions
:
[],
menuOptions
:
[]
}
},
created
()
{
console
.
log
(
'id:'
+
this
.
data
.
id
)
this
.
getDicts
(
'sys_common_status'
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
statusOptions
=
response
.
data
}
})
this
.
getMenuOptions
()
},
mounted
()
{
this
.
getBusiness
(
this
.
data
.
id
)
},
methods
:
{
showCard
()
{
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
/** 获取详情 */
getBusiness
:
function
(
id
)
{
getBusiness
(
id
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
form
=
response
.
data
}
})
},
getMenuOptions
()
{
listMenuForFlow
().
then
(
response
=>
{
if
(
response
.
success
)
{
const
{
data
}
=
response
this
.
menuOptions
=
data
}
})
},
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.el-card
::v-deep
.el-card__body
{
height
:
calc
(
100vh
-
230px
);
overflow-y
:
auto
;
}
</
style
>
datax-ui/src/views/workflow/business/BusinessEdit.vue
0 → 100644
View file @
5c68bd21
<
template
>
<el-card
class=
"box-card"
shadow=
"always"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
{{
title
}}
</span>
<el-button-group
style=
"float: right;"
>
<el-button
size=
"mini"
icon=
"el-icon-plus"
round
:loading=
"loadingOptions.loading"
:disabled=
"loadingOptions.isDisabled"
@
click=
"submitForm"
>
{{
loadingOptions
.
loadingText
}}
</el-button>
<el-button
size=
"mini"
icon=
"el-icon-back"
round
@
click=
"showCard"
>
返回
</el-button>
</el-button-group>
</div>
<div
class=
"body-wrapper"
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"80px"
>
<el-form-item
label=
"业务编码"
prop=
"businessCode"
>
<el-select
v-model=
"form.businessCode"
clearable
filterable
@
change=
"changeValue($event)"
placeholder=
"请输入业务编码"
>
<el-option
v-for=
"item in menuOptions"
:key=
"item.menuCode"
:label=
"item.menuName"
:value=
"item.menuCode"
>
<span
style=
"float: left"
>
{{
'业务名称:'
+
item
.
menuName
+
'-业务编码:'
+
item
.
menuCode
}}
</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label=
"流程定义ID"
prop=
"processDefinitionId"
>
<el-input
v-model=
"form.processDefinitionId"
placeholder=
"请输入流程定义ID"
/>
</el-form-item>
<el-form-item
label=
"消息模板"
prop=
"businessTempalte"
>
<el-input
v-model=
"form.businessTempalte"
type=
"textarea"
placeholder=
"请输入消息模板,模板字段
{nickname、datetime、businessName、businessKey}" />
</el-form-item>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-radio-group
v-model=
"form.status"
>
<el-radio
v-for=
"dict in statusOptions"
:key=
"dict.id"
:label=
"dict.itemText"
>
{{
dict
.
itemValue
}}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"form.remark"
type=
"textarea"
placeholder=
"请输入内容"
/>
</el-form-item>
</el-form>
</div>
</el-card>
</
template
>
<
script
>
import
{
getBusiness
,
updateBusiness
}
from
'@/api/workflow/business'
import
{
listMenuForFlow
}
from
'@/api/system/menu'
export
default
{
name
:
'BusinessEdit'
,
props
:
{
data
:
{
type
:
Object
,
default
:
function
()
{
return
{}
}
}
},
data
()
{
return
{
title
:
'业务流程配置编辑'
,
// 展示切换
showOptions
:
{
data
:
{},
showList
:
true
,
showAdd
:
false
,
showEdit
:
false
,
showDetail
:
false
},
// 保存按钮
loadingOptions
:
{
loading
:
false
,
loadingText
:
'保存'
,
isDisabled
:
false
},
// 表单参数
form
:
{},
// 表单校验
rules
:
{
businessCode
:
[
{
required
:
true
,
message
:
'业务编码不能为空'
,
trigger
:
'blur'
}
],
processDefinitionId
:
[
{
required
:
true
,
message
:
'流程定义ID不能为空'
,
trigger
:
'blur'
}
]
},
// 状态数据字典
statusOptions
:
[],
menuOptions
:
[]
}
},
created
()
{
console
.
log
(
'id:'
+
this
.
data
.
id
)
this
.
getDicts
(
'sys_common_status'
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
statusOptions
=
response
.
data
}
})
this
.
getMenuOptions
()
},
mounted
()
{
this
.
getBusiness
(
this
.
data
.
id
)
},
methods
:
{
showCard
()
{
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
/** 获取详情 */
getBusiness
:
function
(
id
)
{
getBusiness
(
id
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
form
=
response
.
data
}
})
},
getMenuOptions
()
{
listMenuForFlow
().
then
(
response
=>
{
if
(
response
.
success
)
{
const
{
data
}
=
response
this
.
menuOptions
=
data
}
})
},
changeValue
(
value
)
{
const
obj
=
this
.
menuOptions
.
find
(
function
(
item
)
{
return
item
.
menuCode
===
value
})
this
.
form
.
businessName
=
obj
.
menuName
this
.
form
.
businessComponent
=
obj
.
menuComponent
},
/** 提交按钮 */
submitForm
:
function
()
{
this
.
$refs
[
'form'
].
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loadingOptions
.
loading
=
true
this
.
loadingOptions
.
loadingText
=
'保存中...'
this
.
loadingOptions
.
isDisabled
=
true
updateBusiness
(
this
.
form
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$message
.
success
(
'保存成功'
)
setTimeout
(()
=>
{
// 2秒后跳转列表页
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
2000
)
}
else
{
this
.
$message
.
error
(
'保存失败'
)
this
.
loadingOptions
.
loading
=
false
this
.
loadingOptions
.
loadingText
=
'保存'
this
.
loadingOptions
.
isDisabled
=
false
}
}).
catch
(()
=>
{
this
.
loadingOptions
.
loading
=
false
this
.
loadingOptions
.
loadingText
=
'保存'
this
.
loadingOptions
.
isDisabled
=
false
})
}
})
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.el-card
::v-deep
.el-card__body
{
height
:
calc
(
100vh
-
230px
);
overflow-y
:
auto
;
}
</
style
>
datax-ui/src/views/workflow/business/BusinessList.vue
0 → 100644
View file @
5c68bd21
<
template
>
<el-card
class=
"box-card"
shadow=
"always"
>
<el-form
ref=
"queryForm"
:model=
"queryParams"
:inline=
"true"
>
<el-form-item
label=
"业务编码"
prop=
"businessCode"
>
<el-input
v-model=
"queryParams.businessCode"
placeholder=
"请输入业务编码"
clearable
size=
"small"
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
type=
"flex"
justify=
"space-between"
>
<el-col
:span=
"12"
>
<el-button-group>
<el-button
type=
"primary"
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
>
新增
</el-button>
<el-button
type=
"success"
icon=
"el-icon-edit-outline"
size=
"mini"
:disabled=
"single"
@
click=
"handleEdit"
>
修改
</el-button>
<el-button
type=
"info"
icon=
"el-icon-view"
size=
"mini"
:disabled=
"single"
@
click=
"handleDetail"
>
详情
</el-button>
<el-button
type=
"danger"
icon=
"el-icon-delete"
size=
"mini"
:disabled=
"multiple"
@
click=
"handleBatchDelete"
>
删除
</el-button>
<el-button
type=
"warning"
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"handleCacheRefresh"
>
刷新缓存
</el-button>
</el-button-group>
</el-col>
<el-col
:span=
"12"
>
<div
class=
"right-toolbar"
>
<el-tooltip
content=
"密度"
effect=
"dark"
placement=
"top"
>
<el-dropdown
trigger=
"click"
@
command=
"handleCommand"
>
<el-button
circle
size=
"mini"
>
<svg-icon
class-name=
"size-icon"
icon-class=
"colum-height"
/>
</el-button>
<el-dropdown-menu
slot=
"dropdown"
>
<el-dropdown-item
command=
"medium"
>
正常
</el-dropdown-item>
<el-dropdown-item
command=
"small"
>
中等
</el-dropdown-item>
<el-dropdown-item
command=
"mini"
>
紧凑
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-tooltip>
<el-tooltip
content=
"刷新"
effect=
"dark"
placement=
"top"
>
<el-button
circle
size=
"mini"
@
click=
"handleRefresh"
>
<svg-icon
class-name=
"size-icon"
icon-class=
"shuaxin"
/>
</el-button>
</el-tooltip>
<el-tooltip
content=
"列设置"
effect=
"dark"
placement=
"top"
>
<el-popover
placement=
"bottom"
width=
"100"
trigger=
"click"
>
<el-checkbox-group
v-model=
"checkedTableColumns"
@
change=
"handleCheckedColsChange"
>
<el-checkbox
v-for=
"(item, index) in tableColumns"
:key=
"index"
:label=
"item.prop"
>
{{
item
.
label
}}
</el-checkbox>
</el-checkbox-group>
<span
slot=
"reference"
>
<el-button
circle
size=
"mini"
>
<svg-icon
class-name=
"size-icon"
icon-class=
"shezhi"
/>
</el-button>
</span>
</el-popover>
</el-tooltip>
</div>
</el-col>
</el-row>
<el-table
v-loading=
"loading"
:data=
"tableDataList"
border
tooltip-effect=
"dark"
:size=
"tableSize"
:height=
"tableHeight"
style=
"width: 100%;margin: 15px 0;"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"序号"
width=
"55"
align=
"center"
>
<template
slot-scope=
"scope"
>
<span>
{{
scope
.
$index
+
1
}}
</span>
</
template
>
</el-table-column>
<
template
v-for=
"(item, index) in tableColumns"
>
<el-table-column
v-if=
"item.show"
:key=
"index"
:prop=
"item.prop"
:label=
"item.label"
:formatter=
"item.formatter"
align=
"center"
show-overflow-tooltip
/>
</
template
>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-popover
placement=
"left"
trigger=
"click"
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit-outline"
@
click=
"handleEdit(scope.row)"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-view"
@
click=
"handleDetail(scope.row)"
>
详情
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
>
删除
</el-button>
<el-button
slot=
"reference"
>
操作
</el-button>
</el-popover>
</
template
>
</el-table-column>
</el-table>
<el-pagination
:page-sizes=
"[10, 20, 50, 100]"
layout=
"total, sizes, prev, pager, next, jumper"
:current-page
.
sync=
"queryParams.pageNum"
:page-size
.
sync=
"queryParams.pageSize"
:total=
"total"
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
/>
</el-card>
</template>
<
script
>
import
{
pageBusiness
,
delBusiness
,
refreshBusiness
}
from
'@/api/workflow/business'
export
default
{
name
:
'BusinessList'
,
data
()
{
return
{
tableHeight
:
document
.
body
.
offsetHeight
-
310
+
'px'
,
// 展示切换
showOptions
:
{
data
:
{},
showList
:
true
,
showAdd
:
false
,
showEdit
:
false
,
showDetail
:
false
},
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 表格头
tableColumns
:
[
{
prop
:
'businessCode'
,
label
:
'业务编码'
,
show
:
true
},
{
prop
:
'businessName'
,
label
:
'业务名称'
,
show
:
true
},
{
prop
:
'processDefinitionId'
,
label
:
'流程定义ID'
,
show
:
true
},
{
prop
:
'status'
,
label
:
'状态'
,
show
:
true
,
formatter
:
this
.
statusFormatter
},
{
prop
:
'createTime'
,
label
:
'创建时间'
,
show
:
true
}
],
// 默认选择中表格头
checkedTableColumns
:
[],
tableSize
:
'medium'
,
// 表格数据
tableDataList
:
[],
// 总数据条数
total
:
0
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
20
,
businessCode
:
''
},
// 状态数据字典
statusOptions
:
[]
}
},
created
()
{
this
.
getDicts
(
'sys_common_status'
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
statusOptions
=
response
.
data
}
})
this
.
getList
()
},
mounted
()
{
this
.
initCols
()
},
methods
:
{
/** 查询列表 */
getList
()
{
this
.
loading
=
true
pageBusiness
(
this
.
queryParams
).
then
(
response
=>
{
this
.
loading
=
false
if
(
response
.
success
)
{
const
{
data
}
=
response
this
.
tableDataList
=
data
.
data
this
.
total
=
data
.
total
}
})
},
initCols
()
{
this
.
checkedTableColumns
=
this
.
tableColumns
.
map
(
col
=>
col
.
prop
)
},
handleCheckedColsChange
(
val
)
{
this
.
tableColumns
.
forEach
(
col
=>
{
if
(
!
this
.
checkedTableColumns
.
includes
(
col
.
prop
))
{
col
.
show
=
false
}
else
{
col
.
show
=
true
}
})
},
handleCommand
(
command
)
{
this
.
tableSize
=
command
},
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
this
.
getList
()
},
/** 重置按钮操作 */
resetQuery
()
{
this
.
queryParams
=
{
pageNum
:
1
,
pageSize
:
20
,
businessCode
:
''
}
this
.
handleQuery
()
},
/** 刷新列表 */
handleRefresh
()
{
this
.
getList
()
},
/** 多选框选中数据 */
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
},
/** 新增按钮操作 */
handleAdd
()
{
this
.
showOptions
.
data
=
{}
this
.
showOptions
.
showList
=
false
this
.
showOptions
.
showAdd
=
true
this
.
showOptions
.
showEdit
=
false
this
.
showOptions
.
showDetail
=
false
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
/** 修改按钮操作 */
handleEdit
(
row
)
{
this
.
showOptions
.
data
.
id
=
row
.
id
||
this
.
ids
[
0
]
this
.
showOptions
.
showList
=
false
this
.
showOptions
.
showAdd
=
false
this
.
showOptions
.
showEdit
=
true
this
.
showOptions
.
showDetail
=
false
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
/** 详情按钮操作 */
handleDetail
(
row
)
{
this
.
showOptions
.
data
.
id
=
row
.
id
||
this
.
ids
[
0
]
this
.
showOptions
.
showList
=
false
this
.
showOptions
.
showAdd
=
false
this
.
showOptions
.
showEdit
=
false
this
.
showOptions
.
showDetail
=
true
this
.
$emit
(
'showCard'
,
this
.
showOptions
)
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
this
.
$confirm
(
'选中数据将被永久删除, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
delBusiness
(
row
.
id
).
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$message
.
success
(
'删除成功'
)
this
.
getList
()
}
})
}).
catch
(()
=>
{
})
},
/** 批量删除按钮操作 */
handleBatchDelete
()
{
if
(
!
this
.
ids
.
length
)
{
this
.
$message
({
message
:
'请先选择需要操作的数据'
,
type
:
'warning'
})
}
this
.
$message
.
warning
(
'不支持批量删除'
)
},
/** 刷新缓存 */
handleCacheRefresh
()
{
refreshBusiness
().
then
(
response
=>
{
if
(
response
.
success
)
{
this
.
$message
.
success
(
'刷新缓存成功'
)
}
else
{
this
.
$message
.
error
(
'刷新缓存失败'
)
}
})
},
handleSizeChange
(
val
)
{
console
.
log
(
`每页
${
val
}
条`
)
this
.
queryParams
.
pageNum
=
1
this
.
queryParams
.
pageSize
=
val
this
.
getList
()
},
handleCurrentChange
(
val
)
{
console
.
log
(
`当前页:
${
val
}
`
)
this
.
queryParams
.
pageNum
=
val
this
.
getList
()
},
statusFormatter
(
row
,
column
,
cellValue
,
index
)
{
const
dictLabel
=
this
.
selectDictLabel
(
this
.
statusOptions
,
cellValue
)
if
(
cellValue
===
'1'
)
{
return
<
el
-
tag
type
=
'success'
>
{
dictLabel
}
<
/el-tag
>
}
else
{
return
<
el
-
tag
type
=
'warning'
>
{
dictLabel
}
<
/el-tag
>
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.right-toolbar
{
float
:
right
;
}
.el-card
::v-deep
.el-card__body
{
height
:
calc
(
100vh
-
170px
);
}
</
style
>
datax-ui/src/views/workflow/business/index.vue
0 → 100644
View file @
5c68bd21
<
template
>
<div
class=
"app-container"
>
<transition
name=
"el-zoom-in-center"
>
<business-list
v-if=
"options.showList"
@
showCard=
"showCard"
/>
</transition>
<transition
name=
"el-zoom-in-top"
>
<business-add
v-if=
"options.showAdd"
:data=
"options.data"
@
showCard=
"showCard"
/>
</transition>
<transition
name=
"el-zoom-in-top"
>
<business-edit
v-if=
"options.showEdit"
:data=
"options.data"
@
showCard=
"showCard"
/>
</transition>
<transition
name=
"el-zoom-in-bottom"
>
<business-detail
v-if=
"options.showDetail"
:data=
"options.data"
@
showCard=
"showCard"
/>
</transition>
</div>
</
template
>
<
script
>
import
BusinessList
from
'./BusinessList'
import
BusinessAdd
from
'./BusinessAdd'
import
BusinessEdit
from
'./BusinessEdit'
import
BusinessDetail
from
'./BusinessDetail'
export
default
{
name
:
'Business'
,
components
:
{
BusinessList
,
BusinessAdd
,
BusinessEdit
,
BusinessDetail
},
data
()
{
return
{
options
:
{
data
:
{},
showList
:
true
,
showAdd
:
false
,
showEdit
:
false
,
showDetail
:
false
}
}
},
methods
:
{
showCard
(
data
)
{
Object
.
assign
(
this
.
options
,
data
)
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment