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
e01692fe
Commit
e01692fe
authored
Sep 10, 2020
by
yuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
项目初始化
parent
3d34c8b5
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
775 additions
and
7 deletions
+775
-7
Generate.java
...rc/main/java/cn/datax/service/codegen/utils/Generate.java
+7
-7
CategoryDto.java
...n/java/cn/datax/service/workflow/api/dto/CategoryDto.java
+30
-0
CategoryEntity.java
.../cn/datax/service/workflow/api/entity/CategoryEntity.java
+29
-0
CategoryQuery.java
...va/cn/datax/service/workflow/api/query/CategoryQuery.java
+22
-0
DefinitionQuery.java
.../cn/datax/service/workflow/api/query/DefinitionQuery.java
+16
-0
CategoryVo.java
...ain/java/cn/datax/service/workflow/api/vo/CategoryVo.java
+27
-0
CategoryController.java
...datax/service/workflow/controller/CategoryController.java
+134
-0
DefinitionController.java
...tax/service/workflow/controller/DefinitionController.java
+112
-0
InnerController.java
...cn/datax/service/workflow/controller/InnerController.java
+11
-0
InstanceController.java
...datax/service/workflow/controller/InstanceController.java
+17
-0
TaskController.java
.../cn/datax/service/workflow/controller/TaskController.java
+17
-0
CategoryDao.java
.../main/java/cn/datax/service/workflow/dao/CategoryDao.java
+18
-0
CategoryMapper.java
...a/cn/datax/service/workflow/mapstruct/CategoryMapper.java
+20
-0
CategoryService.java
...va/cn/datax/service/workflow/service/CategoryService.java
+28
-0
ProcessDefinitionService.java
...ax/service/workflow/service/ProcessDefinitionService.java
+62
-0
ProcessInstanceService.java
...atax/service/workflow/service/ProcessInstanceService.java
+4
-0
ProcessTaskService.java
...cn/datax/service/workflow/service/ProcessTaskService.java
+4
-0
CategoryServiceImpl.java
...ax/service/workflow/service/impl/CategoryServiceImpl.java
+67
-0
ProcessDefinitionServiceImpl.java
...e/workflow/service/impl/ProcessDefinitionServiceImpl.java
+104
-0
ProcessInstanceServiceImpl.java
...ice/workflow/service/impl/ProcessInstanceServiceImpl.java
+8
-0
ProcessTaskServiceImpl.java
...service/workflow/service/impl/ProcessTaskServiceImpl.java
+8
-0
CategoryMapper.xml
...flow-service/src/main/resources/mapper/CategoryMapper.xml
+30
-0
No files found.
datax-modules/codegen-service-parent/codegen-service/src/main/java/cn/datax/service/codegen/utils/Generate.java
View file @
e01692fe
...
@@ -11,17 +11,17 @@ import com.baomidou.mybatisplus.generator.config.po.TableInfo;
...
@@ -11,17 +11,17 @@ import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import
com.baomidou.mybatisplus.generator.config.rules.NamingStrategy
;
import
com.baomidou.mybatisplus.generator.config.rules.NamingStrategy
;
import
java.io.File
;
import
java.io.File
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
Generate
{
public
class
Generate
{
// public static void main(String[] args) {
// public static void main(String[] args)
throws InterruptedException
{
//// DefaultIdentifierGenerator generator = new DefaultIdentifierGenerator();
//// DefaultIdentifierGenerator generator = new DefaultIdentifierGenerator();
//// System.out.println(generator.nextId(null));
//// for (int i = 0; i < 10; i++) {
// generateByTables("F://code", "masterdata", "cn.datax.service.data", "masterdata_", new String[]{"masterdata_model", "masterdata_model_column"});
//// Thread.sleep(new Random().nextInt(1000 - 500 + 1) + 500);
//// System.out.println(generator.nextId(null));
//// }
// generateByTables("F://code", "workflow", "cn.datax.service", "flow_", new String[]{"flow_category"});
// }
// }
/**
/**
...
...
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/dto/CategoryDto.java
0 → 100644
View file @
e01692fe
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
java.io.Serializable
;
/**
* <p>
* 流程分类表 实体DTO
* </p>
*
* @author yuwei
* @since 2020-09-10
*/
@ApiModel
(
value
=
"流程分类表Model"
)
@Data
public
class
CategoryDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"主键ID"
)
@NotBlank
(
message
=
"主键ID不能为空"
,
groups
=
{
ValidationGroups
.
Update
.
class
})
private
String
id
;
@ApiModelProperty
(
value
=
"分类名称"
)
private
String
name
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/entity/CategoryEntity.java
0 → 100644
View file @
e01692fe
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-10
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"flow_category"
)
public
class
CategoryEntity
extends
DataScopeBaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 分类名称
*/
private
String
name
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/query/CategoryQuery.java
0 → 100644
View file @
e01692fe
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-10
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
CategoryQuery
extends
BaseQueryParams
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
name
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/query/DefinitionQuery.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
api
.
query
;
import
cn.datax.common.base.BaseQueryParams
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
DefinitionQuery
extends
BaseQueryParams
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
name
;
private
String
key
;
private
String
categoryId
;
}
datax-modules/workflow-service-parent/workflow-service-api/src/main/java/cn/datax/service/workflow/api/vo/CategoryVo.java
0 → 100644
View file @
e01692fe
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-10
*/
@Data
public
class
CategoryVo
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
name
;
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/controller/CategoryController.java
0 → 100644
View file @
e01692fe
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.CategoryDto
;
import
cn.datax.service.workflow.api.entity.CategoryEntity
;
import
cn.datax.service.workflow.api.vo.CategoryVo
;
import
cn.datax.service.workflow.api.query.CategoryQuery
;
import
cn.datax.service.workflow.mapstruct.CategoryMapper
;
import
cn.datax.service.workflow.service.CategoryService
;
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-10
*/
@Api
(
tags
=
{
"流程分类表"
})
@RestController
@RequestMapping
(
"/categorys"
)
public
class
CategoryController
extends
BaseController
{
@Autowired
private
CategoryService
categoryService
;
@Autowired
private
CategoryMapper
categoryMapper
;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation
(
value
=
"获取详细信息"
,
notes
=
"根据url的id来获取详细信息"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@GetMapping
(
"/{id}"
)
public
R
getCategoryById
(
@PathVariable
String
id
)
{
CategoryEntity
categoryEntity
=
categoryService
.
getCategoryById
(
id
);
return
R
.
ok
().
setData
(
categoryMapper
.
toVO
(
categoryEntity
));
}
/**
* 分页查询信息
*
* @param categoryQuery
* @return
*/
@ApiOperation
(
value
=
"分页查询"
,
notes
=
""
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"categoryQuery"
,
value
=
"查询实体categoryQuery"
,
required
=
true
,
dataTypeClass
=
CategoryQuery
.
class
)
})
@GetMapping
(
"/page"
)
public
R
getCategoryPage
(
CategoryQuery
categoryQuery
)
{
QueryWrapper
<
CategoryEntity
>
queryWrapper
=
new
QueryWrapper
<>();
IPage
<
CategoryEntity
>
page
=
categoryService
.
page
(
new
Page
<>(
categoryQuery
.
getPageNum
(),
categoryQuery
.
getPageSize
()),
queryWrapper
);
List
<
CategoryVo
>
collect
=
page
.
getRecords
().
stream
().
map
(
categoryMapper:
:
toVO
).
collect
(
Collectors
.
toList
());
JsonPage
<
CategoryVo
>
jsonPage
=
new
JsonPage
<>(
page
.
getCurrent
(),
page
.
getSize
(),
page
.
getTotal
(),
collect
);
return
R
.
ok
().
setData
(
jsonPage
);
}
/**
* 添加
* @param category
* @return
*/
@ApiOperation
(
value
=
"添加信息"
,
notes
=
"根据category对象添加信息"
)
@ApiImplicitParam
(
name
=
"category"
,
value
=
"详细实体category"
,
required
=
true
,
dataType
=
"CategoryDto"
)
@PostMapping
()
public
R
saveCategory
(
@RequestBody
@Validated
({
ValidationGroups
.
Insert
.
class
})
CategoryDto
category
)
{
CategoryEntity
categoryEntity
=
categoryService
.
saveCategory
(
category
);
return
R
.
ok
().
setData
(
categoryMapper
.
toVO
(
categoryEntity
));
}
/**
* 修改
* @param category
* @return
*/
@ApiOperation
(
value
=
"修改信息"
,
notes
=
"根据url的id来指定修改对象,并根据传过来的信息来修改详细信息"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
),
@ApiImplicitParam
(
name
=
"category"
,
value
=
"详细实体category"
,
required
=
true
,
dataType
=
"CategoryDto"
)
})
@PutMapping
(
"/{id}"
)
public
R
updateCategory
(
@PathVariable
String
id
,
@RequestBody
@Validated
({
ValidationGroups
.
Update
.
class
})
CategoryDto
category
)
{
CategoryEntity
categoryEntity
=
categoryService
.
updateCategory
(
category
);
return
R
.
ok
().
setData
(
categoryMapper
.
toVO
(
categoryEntity
));
}
/**
* 删除
* @param id
* @return
*/
@ApiOperation
(
value
=
"删除"
,
notes
=
"根据url的id来指定删除对象"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{id}"
)
public
R
deleteCategoryById
(
@PathVariable
String
id
)
{
categoryService
.
deleteCategoryById
(
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
deleteCategoryBatch
(
@PathVariable
List
<
String
>
ids
)
{
categoryService
.
deleteCategoryBatch
(
ids
);
return
R
.
ok
();
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/controller/DefinitionController.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
controller
;
import
cn.datax.common.base.BaseController
;
import
cn.datax.common.core.R
;
import
cn.datax.service.workflow.api.query.CategoryQuery
;
import
cn.datax.service.workflow.api.query.DefinitionQuery
;
import
cn.datax.service.workflow.service.ProcessDefinitionService
;
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.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.Charset
;
import
java.util.zip.ZipInputStream
;
@Api
(
tags
=
{
"流程定义"
})
@RestController
@RequestMapping
(
"/definitions"
)
public
class
DefinitionController
extends
BaseController
{
@Autowired
private
ProcessDefinitionService
processDefinitionService
;
@ApiOperation
(
value
=
"分页查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"categoryQuery"
,
value
=
"查询实体categoryQuery"
,
required
=
true
,
dataTypeClass
=
CategoryQuery
.
class
)
})
@GetMapping
(
"/page"
)
public
R
page
(
DefinitionQuery
definitionQuery
)
{
processDefinitionService
.
page
(
definitionQuery
);
return
R
.
ok
();
}
@PostMapping
(
"/import/file"
)
@ApiOperation
(
value
=
"部署流程模板文件"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"模板名称(模板name)"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"category"
,
value
=
"模板类别"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"tenantId"
,
value
=
"系统标识"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"file"
,
value
=
"模板文件"
,
required
=
true
,
dataType
=
"__file"
)
})
public
R
deployByInputStream
(
String
name
,
String
category
,
String
tenantId
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
try
(
InputStream
in
=
file
.
getInputStream
())
{
processDefinitionService
.
deploy
(
name
,
category
,
tenantId
,
in
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
R
.
ok
();
}
@PostMapping
(
"/import/files/zip"
)
@ApiOperation
(
value
=
"部署压缩包形式的模板(.zip.bar)"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"name"
,
value
=
"模板名称(模板name)"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"category"
,
value
=
"模板类别"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"tenantId"
,
value
=
"系统标识"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"file"
,
value
=
"模板文件"
,
required
=
true
,
dataType
=
"__file"
)
})
public
R
deployByZip
(
String
name
,
String
category
,
String
tenantId
,
@RequestParam
(
"file"
)
MultipartFile
file
)
{
try
(
ZipInputStream
zipIn
=
new
ZipInputStream
(
file
.
getInputStream
(),
Charset
.
forName
(
"UTF-8"
)))
{
processDefinitionService
.
deploy
(
name
,
category
,
tenantId
,
zipIn
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
R
.
ok
();
}
@ApiOperation
(
value
=
"激活流程定义"
,
notes
=
"根据url的id来指定激活流程定义"
)
@ApiImplicitParam
(
name
=
"processDefinitionId"
,
value
=
"流程定义ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@PutMapping
(
"/activate/{processDefinitionId}"
)
public
R
activate
(
@PathVariable
String
processDefinitionId
)
{
processDefinitionService
.
activateProcessDefinitionById
(
processDefinitionId
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"挂起流程定义"
,
notes
=
"根据url的id来指定挂起流程定义"
)
@ApiImplicitParam
(
name
=
"processDefinitionId"
,
value
=
"流程定义ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@PutMapping
(
"/suspend/{processDefinitionId}"
)
public
R
suspend
(
@PathVariable
String
processDefinitionId
)
{
processDefinitionService
.
suspendProcessDefinitionById
(
processDefinitionId
);
return
R
.
ok
();
}
@ApiOperation
(
value
=
"删除流程定义"
,
notes
=
"根据url的id来指定删除流程定义"
)
@ApiImplicitParam
(
name
=
"deploymentId"
,
value
=
"流程部署ID"
,
required
=
true
,
dataType
=
"String"
,
paramType
=
"path"
)
@DeleteMapping
(
"/delete/{deploymentId}"
)
public
R
delete
(
@PathVariable
String
deploymentId
)
{
processDefinitionService
.
deleteDeployment
(
deploymentId
);
return
R
.
ok
();
}
@GetMapping
(
"/resource"
)
@ApiOperation
(
value
=
"查看流程部署xml资源和png资源"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
"processDefinitionId"
,
value
=
"流程定义ID"
,
required
=
true
,
dataType
=
"String"
),
@ApiImplicitParam
(
name
=
"resType"
,
value
=
"资源类型(xml|image)"
,
required
=
true
,
dataType
=
"String"
)
})
public
void
resource
(
String
processDefinitionId
,
String
resType
,
HttpServletResponse
response
)
throws
Exception
{
InputStream
resourceAsStream
=
processDefinitionService
.
resource
(
processDefinitionId
,
resType
);
byte
[]
b
=
new
byte
[
1024
];
int
len
=
-
1
;
while
((
len
=
resourceAsStream
.
read
(
b
,
0
,
1024
))
!=
-
1
)
{
response
.
getOutputStream
().
write
(
b
,
0
,
len
);
}
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/controller/InnerController.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
controller
;
import
cn.datax.common.base.BaseController
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/inner"
)
public
class
InnerController
extends
BaseController
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/controller/InstanceController.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
controller
;
import
cn.datax.common.base.BaseController
;
import
cn.datax.service.workflow.service.ProcessInstanceService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
{
"流程实例"
})
@RestController
@RequestMapping
(
"/definitions"
)
public
class
InstanceController
extends
BaseController
{
@Autowired
private
ProcessInstanceService
processInstanceService
;
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/controller/TaskController.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
controller
;
import
cn.datax.common.base.BaseController
;
import
cn.datax.service.workflow.service.ProcessTaskService
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@Api
(
tags
=
{
"流程任务"
})
@RestController
@RequestMapping
(
"/definitions"
)
public
class
TaskController
extends
BaseController
{
@Autowired
private
ProcessTaskService
processTaskService
;
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/dao/CategoryDao.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
dao
;
import
cn.datax.common.base.BaseDao
;
import
cn.datax.service.workflow.api.entity.CategoryEntity
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* <p>
* 流程分类表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-10
*/
@Mapper
public
interface
CategoryDao
extends
BaseDao
<
CategoryEntity
>
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/mapstruct/CategoryMapper.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
mapstruct
;
import
cn.datax.common.mapstruct.EntityMapper
;
import
cn.datax.service.workflow.api.dto.CategoryDto
;
import
cn.datax.service.workflow.api.entity.CategoryEntity
;
import
cn.datax.service.workflow.api.vo.CategoryVo
;
import
org.mapstruct.Mapper
;
/**
* <p>
* 流程分类表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-10
*/
@Mapper
(
componentModel
=
"spring"
)
public
interface
CategoryMapper
extends
EntityMapper
<
CategoryDto
,
CategoryEntity
,
CategoryVo
>
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/CategoryService.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
;
import
cn.datax.service.workflow.api.entity.CategoryEntity
;
import
cn.datax.service.workflow.api.dto.CategoryDto
;
import
cn.datax.common.base.BaseService
;
import
java.util.List
;
/**
* <p>
* 流程分类表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-10
*/
public
interface
CategoryService
extends
BaseService
<
CategoryEntity
>
{
CategoryEntity
saveCategory
(
CategoryDto
category
);
CategoryEntity
updateCategory
(
CategoryDto
category
);
CategoryEntity
getCategoryById
(
String
id
);
void
deleteCategoryById
(
String
id
);
void
deleteCategoryBatch
(
List
<
String
>
ids
);
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/ProcessDefinitionService.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
;
import
cn.datax.service.workflow.api.query.DefinitionQuery
;
import
java.io.InputStream
;
import
java.util.zip.ZipInputStream
;
public
interface
ProcessDefinitionService
{
/**
* 部署流程资源
*
* @param name 流程模板文件名字
* @param category 流程模板文件类别
* @param in 流程模板文件流
* @return
*/
void
deploy
(
String
name
,
String
category
,
String
tenantId
,
InputStream
in
);
/**
* 部署压缩包内的流程资源
*
* @param name 流程模板文件名字
* @param category 流程模板文件类别
* @param tenantId 业务系统标识
* @param zipInputStream
* @return
*/
void
deploy
(
String
name
,
String
category
,
String
tenantId
,
ZipInputStream
zipInputStream
);
/**
* 激活流程定义
* @param processDefinitionId
*/
void
activateProcessDefinitionById
(
String
processDefinitionId
);
/**
* 挂起流程定义
* @param processDefinitionId
*/
void
suspendProcessDefinitionById
(
String
processDefinitionId
);
/**
* 删除流程定义
* @param deploymentId
*/
void
deleteDeployment
(
String
deploymentId
);
/**
* 查看流程部署xml资源和png资源
* @param processDefinitionId
* @param resType
* @return
*/
InputStream
resource
(
String
processDefinitionId
,
String
resType
);
/**
* 分页查询流程定义实例
* @param definitionQuery
*/
void
page
(
DefinitionQuery
definitionQuery
);
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/ProcessInstanceService.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
;
public
interface
ProcessInstanceService
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/ProcessTaskService.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
;
public
interface
ProcessTaskService
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/impl/CategoryServiceImpl.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
.
impl
;
import
cn.datax.service.workflow.api.entity.CategoryEntity
;
import
cn.datax.service.workflow.api.dto.CategoryDto
;
import
cn.datax.service.workflow.service.CategoryService
;
import
cn.datax.service.workflow.mapstruct.CategoryMapper
;
import
cn.datax.service.workflow.dao.CategoryDao
;
import
cn.datax.common.base.BaseServiceImpl
;
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
;
/**
* <p>
* 流程分类表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-10
*/
@Service
@Transactional
(
propagation
=
Propagation
.
SUPPORTS
,
readOnly
=
true
,
rollbackFor
=
Exception
.
class
)
public
class
CategoryServiceImpl
extends
BaseServiceImpl
<
CategoryDao
,
CategoryEntity
>
implements
CategoryService
{
@Autowired
private
CategoryDao
categoryDao
;
@Autowired
private
CategoryMapper
categoryMapper
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
CategoryEntity
saveCategory
(
CategoryDto
categoryDto
)
{
CategoryEntity
category
=
categoryMapper
.
toEntity
(
categoryDto
);
categoryDao
.
insert
(
category
);
return
category
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
CategoryEntity
updateCategory
(
CategoryDto
categoryDto
)
{
CategoryEntity
category
=
categoryMapper
.
toEntity
(
categoryDto
);
categoryDao
.
updateById
(
category
);
return
category
;
}
@Override
public
CategoryEntity
getCategoryById
(
String
id
)
{
CategoryEntity
categoryEntity
=
super
.
getById
(
id
);
return
categoryEntity
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteCategoryById
(
String
id
)
{
categoryDao
.
deleteById
(
id
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
deleteCategoryBatch
(
List
<
String
>
ids
)
{
categoryDao
.
deleteBatchIds
(
ids
);
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/impl/ProcessDefinitionServiceImpl.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
.
impl
;
import
cn.datax.service.workflow.api.query.DefinitionQuery
;
import
cn.datax.service.workflow.service.ProcessDefinitionService
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.commons.lang3.StringUtils
;
import
org.flowable.engine.RepositoryService
;
import
org.flowable.engine.repository.Deployment
;
import
org.flowable.engine.repository.DeploymentBuilder
;
import
org.flowable.engine.repository.ProcessDefinition
;
import
org.flowable.engine.repository.ProcessDefinitionQuery
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.io.InputStream
;
import
java.util.List
;
import
java.util.zip.ZipInputStream
;
@Service
public
class
ProcessDefinitionServiceImpl
implements
ProcessDefinitionService
{
@Autowired
private
RepositoryService
repositoryService
;
public
static
final
String
BPMN20_FILE_SUFFIX
=
".bpmn20.xml"
;
public
static
final
String
RESOURCE_TYPE_IMAGE
=
"image"
;
public
static
final
String
RESOURCE_TYPE_XML
=
"xml"
;
@Override
public
void
page
(
DefinitionQuery
definitionQuery
)
{
ProcessDefinitionQuery
processDefinitionQuery
=
repositoryService
.
createProcessDefinitionQuery
();
if
(
StrUtil
.
isNotBlank
(
definitionQuery
.
getName
()))
{
processDefinitionQuery
.
processDefinitionNameLike
(
definitionQuery
.
getName
());
}
if
(
StringUtils
.
isNotBlank
(
definitionQuery
.
getKey
())){
processDefinitionQuery
.
processDefinitionKeyLike
(
definitionQuery
.
getKey
());
}
if
(
StringUtils
.
isNotBlank
(
definitionQuery
.
getCategoryId
())){
processDefinitionQuery
.
processDefinitionCategory
(
definitionQuery
.
getCategoryId
());
}
long
count
=
processDefinitionQuery
.
count
();
List
<
ProcessDefinition
>
processDefinitionList
=
processDefinitionQuery
.
listPage
((
definitionQuery
.
getPageNum
()
-
1
)
*
definitionQuery
.
getPageSize
(),
definitionQuery
.
getPageSize
());
Page
<
ProcessDefinition
>
page
=
new
Page
<>(
definitionQuery
.
getPageNum
(),
definitionQuery
.
getPageSize
());
page
.
setRecords
(
processDefinitionList
);
page
.
setTotal
(
count
);
}
@Override
public
void
deploy
(
String
name
,
String
category
,
String
tenantId
,
InputStream
in
)
{
DeploymentBuilder
deploymentBuilder
=
repositoryService
.
createDeployment
();
deploymentBuilder
.
addInputStream
(
name
+
BPMN20_FILE_SUFFIX
,
in
);
deploymentBuilder
.
name
(
name
);
if
(
StrUtil
.
isNotBlank
(
tenantId
))
{
deploymentBuilder
.
tenantId
(
tenantId
);
}
if
(
StrUtil
.
isNotBlank
(
category
))
{
deploymentBuilder
.
category
(
category
);
}
Deployment
deployment
=
deploymentBuilder
.
deploy
();
}
@Override
public
void
deploy
(
String
name
,
String
category
,
String
tenantId
,
ZipInputStream
zipInputStream
)
{
DeploymentBuilder
deploymentBuilder
=
repositoryService
.
createDeployment
();
deploymentBuilder
.
addZipInputStream
(
zipInputStream
);
deploymentBuilder
.
name
(
name
);
if
(
StrUtil
.
isNotBlank
(
tenantId
))
{
deploymentBuilder
.
tenantId
(
tenantId
);
}
if
(
StrUtil
.
isNotBlank
(
category
))
{
deploymentBuilder
.
category
(
category
);
}
Deployment
deployment
=
deploymentBuilder
.
deploy
();
}
@Override
public
void
activateProcessDefinitionById
(
String
processDefinitionId
)
{
repositoryService
.
activateProcessDefinitionById
(
processDefinitionId
,
true
,
null
);
}
@Override
public
void
suspendProcessDefinitionById
(
String
processDefinitionId
)
{
repositoryService
.
suspendProcessDefinitionById
(
processDefinitionId
,
true
,
null
);
}
@Override
public
void
deleteDeployment
(
String
deploymentId
)
{
repositoryService
.
deleteDeployment
(
deploymentId
,
true
);
}
@Override
public
InputStream
resource
(
String
processDefinitionId
,
String
resType
)
{
ProcessDefinition
processDefinition
=
repositoryService
.
createProcessDefinitionQuery
().
processDefinitionId
(
processDefinitionId
).
singleResult
();
String
resourceName
=
""
;
if
(
RESOURCE_TYPE_IMAGE
.
equals
(
resType
))
{
resourceName
=
processDefinition
.
getDiagramResourceName
();
}
else
if
(
RESOURCE_TYPE_XML
.
equals
(
resType
))
{
resourceName
=
processDefinition
.
getResourceName
();
}
InputStream
resourceAsStream
=
repositoryService
.
getResourceAsStream
(
processDefinition
.
getDeploymentId
(),
resourceName
);
return
resourceAsStream
;
}
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/impl/ProcessInstanceServiceImpl.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
.
impl
;
import
cn.datax.service.workflow.service.ProcessInstanceService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
ProcessInstanceServiceImpl
implements
ProcessInstanceService
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/java/cn/datax/service/workflow/service/impl/ProcessTaskServiceImpl.java
0 → 100644
View file @
e01692fe
package
cn
.
datax
.
service
.
workflow
.
service
.
impl
;
import
cn.datax.service.workflow.service.ProcessTaskService
;
import
org.springframework.stereotype.Service
;
@Service
public
class
ProcessTaskServiceImpl
implements
ProcessTaskService
{
}
datax-modules/workflow-service-parent/workflow-service/src/main/resources/mapper/CategoryMapper.xml
0 → 100644
View file @
e01692fe
<?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.CategoryDao"
>
<!-- 通用查询映射结果 -->
<resultMap
id=
"BaseResultMap"
type=
"cn.datax.service.workflow.api.entity.CategoryEntity"
>
<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=
"name"
property=
"name"
/>
</resultMap>
<!-- 通用查询结果列 -->
<sql
id=
"Base_Column_List"
>
id,
status,
create_by,
create_time,
create_dept,
update_by,
update_time,
remark, name
</sql>
</mapper>
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