Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
workflow-core
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
workflow-core
Commits
cf5ab4d5
提交
cf5ab4d5
authored
3月 05, 2021
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复了 insertValues 日期无法正常上传的BUG
上级
73f175b4
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
79 行增加
和
168 行删除
+79
-168
pom.xml
pom.xml
+15
-2
WorkflowCoreApplication.java
...n/java/com/tykj/workflowcore/WorkflowCoreApplication.java
+0
-1
WorkflowCoreRunner.java
src/main/java/com/tykj/workflowcore/WorkflowCoreRunner.java
+0
-2
ColumnController.java
...workflowcore/model_layer/controller/ColumnController.java
+0
-50
ModelController.java
.../workflowcore/model_layer/controller/ModelController.java
+5
-4
TableInfoController.java
...kflowcore/model_layer/controller/TableInfoController.java
+0
-34
TableInfo.java
...va/com/tykj/workflowcore/model_layer/model/TableInfo.java
+2
-4
ModelImpl.java
...tykj/workflowcore/model_layer/service/impl/ModelImpl.java
+39
-5
WebMvcConfig.java
...ykj/workflowcore/workflow_editer/config/WebMvcConfig.java
+0
-45
WorkFlowServiceImpl.java
...ore/workflow_editer/service/impl/WorkFlowServiceImpl.java
+7
-8
application.yml
src/main/resources/application.yml
+11
-0
WorkflowCoreApplicationTests.java
...a/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
+0
-13
没有找到文件。
pom.xml
浏览文件 @
cf5ab4d5
...
...
@@ -31,6 +31,7 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<!-- 下面是我引入的东西 zsp-->
<dependency>
<groupId>
com.github.caspar-chen
</groupId>
...
...
@@ -95,16 +96,28 @@
<version>
1.6.1
</version>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-core
</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*
</include>
</includes>
<excludes>
<exclude>
**/.svn/*
</exclude>
</excludes>
<filtering>
false
</filtering>
</resource>
</resources>
<plugins>
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
...
...
src/main/java/com/tykj/workflowcore/WorkflowCoreApplication.java
浏览文件 @
cf5ab4d5
...
...
@@ -9,7 +9,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
* @author admin
*/
@SpringBootApplication
@EnableJpaAuditing
public
class
WorkflowCoreApplication
{
...
...
src/main/java/com/tykj/workflowcore/WorkflowCoreRunner.java
浏览文件 @
cf5ab4d5
...
...
@@ -20,7 +20,6 @@ public class WorkflowCoreRunner implements CommandLineRunner {
return
getClass
().
getClassLoader
();
}
@Override
public
void
run
(
String
...
args
)
{
System
.
out
.
println
(
"核心成功启动"
);
...
...
@@ -31,7 +30,6 @@ public class WorkflowCoreRunner implements CommandLineRunner {
public
void
createXmlMkdir
(){
File
file
=
new
File
(
this
.
getClass
().
getClassLoader
().
getResource
(
""
).
getPath
()+
"\\xml"
);
if
(!
file
.
exists
()){
file
.
mkdir
();
}
}
...
...
src/main/java/com/tykj/workflowcore/model_layer/controller/ColumnController.java
deleted
100644 → 0
浏览文件 @
73f175b4
package
com
.
tykj
.
workflowcore
.
model_layer
.
controller
;
import
com.tykj.workflowcore.model_layer.dao.ColumnInfoDao
;
import
com.tykj.workflowcore.model_layer.model.ColumnInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
* @ClassName ColumnController
* @Description TODO
* @Author WWW
* @Date 2021/2/24 14:33
* @Version 1.0
*/
@RestController
@RequestMapping
(
"/Column"
)
public
class
ColumnController
{
@Autowired
private
ColumnInfoDao
columnInfoDao
;
@PostMapping
(
"/addColumnInfo"
)
public
ColumnInfo
addColumnInfo
(
@RequestBody
ColumnInfo
columnInfo
)
{
ColumnInfo
save
=
columnInfoDao
.
save
(
columnInfo
);
if
(
save
!=
null
)
{
return
save
;
}
return
null
;
}
@GetMapping
(
"/getInfo"
)
public
List
<
ColumnInfo
>
getAll
()
{
List
<
ColumnInfo
>
all
=
columnInfoDao
.
findAll
();
return
all
;
}
@GetMapping
(
"/getInfo/{id}"
)
public
ColumnInfo
getOne
(
@PathVariable
(
"id"
)
long
id
)
{
ColumnInfo
one
=
columnInfoDao
.
findById
(
id
).
get
();
return
one
;
}
}
src/main/java/com/tykj/workflowcore/model_layer/controller/ModelController.java
浏览文件 @
cf5ab4d5
...
...
@@ -47,9 +47,9 @@ public class ModelController {
}
@PostMapping
(
"/addModel"
)
public
ResponseEntity
addModel
(
@RequestBody
String
jsonStr
)
throws
Exception
{
TableVO
tableVO
=
modelService
.
addModel
(
jsonStr
);
//入参使用VO直接接收即可
//jsonStr -> TableVo
public
ResponseEntity
addModel
(
@RequestBody
TableVO
tableVO
)
throws
Exception
{
List
<
TableInfo
>
tableInfos
=
modelService
.
ListAllEntities
();
for
(
TableInfo
tableInfo
:
tableInfos
)
{
if
(
tableVO
.
getModelName
()!=
null
&&
tableVO
.
getModelName
().
equals
(
tableInfo
.
getName
())){
...
...
@@ -57,7 +57,8 @@ public class ModelController {
}
}
modelService
.
NewTable
(
tableVO
);
return
new
ResponseEntity
(
HttpStatus
.
ACCEPTED
);
return
new
ResponseEntity
(
HttpStatus
.
OK
);
}
@PostMapping
(
"/insertValues"
)
...
...
src/main/java/com/tykj/workflowcore/model_layer/controller/TableInfoController.java
deleted
100644 → 0
浏览文件 @
73f175b4
package
com
.
tykj
.
workflowcore
.
model_layer
.
controller
;
import
com.tykj.workflowcore.model_layer.dao.TableInfoDao
;
import
com.tykj.workflowcore.model_layer.model.TableInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
/**
* @ClassName TableInfoController
* @Description TODO
* @Author WWW
* @Date 2021/2/24 13:46
* @Version 1.0
*/
@RestController
@RequestMapping
(
"/table"
)
public
class
TableInfoController
{
@Autowired
private
TableInfoDao
tableInfoDao
;
@PostMapping
(
"/addTable"
)
public
TableInfo
addTable
(
@RequestParam
(
"tableName"
)
String
tableName
)
{
TableInfo
tableInfo
=
new
TableInfo
();
tableInfo
.
setName
(
tableName
);
TableInfo
save
=
tableInfoDao
.
save
(
tableInfo
);
if
(
save
!=
null
){
return
save
;
}
return
null
;
}
}
src/main/java/com/tykj/workflowcore/model_layer/model/TableInfo.java
浏览文件 @
cf5ab4d5
...
...
@@ -52,12 +52,10 @@ public class TableInfo implements Serializable {
@Column
(
name
=
"xml"
,
columnDefinition
=
"TEXT"
)
private
String
XML
;
@LastModifiedDate
@Column
(
nullable
=
false
,
name
=
"update_time"
)
@Column
(
name
=
"update_time"
)
private
Date
updateTime
;
@CreatedDate
@Column
(
nullable
=
false
,
updatable
=
false
,
name
=
"create_time"
)
@Column
(
name
=
"create_time"
)
private
Date
createTime
;
...
...
src/main/java/com/tykj/workflowcore/model_layer/service/impl/ModelImpl.java
浏览文件 @
cf5ab4d5
...
...
@@ -16,8 +16,13 @@ import org.hibernate.boot.Metadata;
import
org.hibernate.boot.MetadataSources
;
import
org.hibernate.boot.registry.StandardServiceRegistry
;
import
org.hibernate.internal.SessionImpl
;
import
org.hibernate.persister.entity.EntityPersister
;
import
org.hibernate.tool.hbm2ddl.SchemaUpdate
;
import
org.hibernate.tool.schema.TargetType
;
import
org.hibernate.type.IntegerType
;
import
org.hibernate.type.StringType
;
import
org.hibernate.type.TimestampType
;
import
org.hibernate.type.Type
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.data.jpa.domain.Specification
;
...
...
@@ -37,6 +42,9 @@ import java.sql.Connection;
import
java.sql.DatabaseMetaData
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -182,12 +190,9 @@ public class ModelImpl implements ModelService {
map
.
keySet
())
{
//查找对应的表
Specification
spec
=
(
Specification
)
(
root
,
criteriaQuery
,
criteriaBuilder
)
->
{
Predicate
equal
=
null
;
if
(
StringUtils
.
isEmpty
(
"Name"
))
{
Path
name
=
root
.
get
(
"Name"
);
equal
=
criteriaBuilder
.
equal
(
name
,
tableName
);
}
Path
name
=
root
.
get
(
"Name"
);
equal
=
criteriaBuilder
.
equal
(
name
,
tableName
);
return
equal
;
};
Optional
one
=
tableInfoDao
.
findOne
(
spec
);
...
...
@@ -226,6 +231,35 @@ public class ModelImpl implements ModelService {
SessionFactory
newSessionFactory
=
metadata
.
buildSessionFactory
();
//保存对象
Session
newSession
=
newSessionFactory
.
openSession
();
SessionImpl
session
=
(
SessionImpl
)
newSession
;
EntityPersister
entityPersister
=
session
.
getEntityPersister
(
tableName
,
map
);
Type
[]
propertyTypes
=
entityPersister
.
getPropertyTypes
();
String
[]
propertyNames
=
entityPersister
.
getEntityPersister
().
getPropertyNames
();
Object
[]
propertyValuesToInsert
=
entityPersister
.
getPropertyValuesToInsert
(
map
,
null
,
session
);
for
(
int
i
=
0
;
i
<
propertyValuesToInsert
.
length
;
i
++)
{
Object
value
=
propertyValuesToInsert
[
i
];
Type
propertyType
=
propertyTypes
[
i
];
//先将Type转为java类
if
(
propertyType
instanceof
TimestampType
){
try
{
Date
parse
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
parse
((
String
)
value
);
map
.
put
(
propertyNames
[
i
],
parse
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
if
(
propertyType
instanceof
IntegerType
){
//然后调用强转方法
}
if
(
propertyType
instanceof
StringType
){
//然后调用强转方法
}
}
newSession
.
saveOrUpdate
(
tableName
,
map
);
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/config/WebMvcConfig.java
deleted
100644 → 0
浏览文件 @
73f175b4
package
com
.
tykj
.
workflowcore
.
workflow_editer
.
config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.CorsRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
/**
* @author zsp
* @version V1.0
* @class WebMvcConfig
* @packageName com.example.personnelmanager.common.config
* @data 2020/6/11
**/
@Configuration
public
class
WebMvcConfig
{
@Value
(
"${file.path}"
)
String
filePath
;
@Bean
public
WebMvcConfigurer
corsConfigurer
()
{
return
new
WebMvcConfigurer
()
{
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
.
allowedOriginPatterns
(
"*"
)
.
allowCredentials
(
true
)
.
allowedMethods
(
"GET"
,
"POST"
,
"DELETE"
,
"PUT"
,
"PATCH"
)
.
maxAge
(
3600
);
}
/*
* 静态资源配置
**/
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/file/**"
).
addResourceLocations
(
"file:"
+
filePath
);
}
};
}
}
src/main/java/com/tykj/workflowcore/workflow_editer/service/impl/WorkFlowServiceImpl.java
浏览文件 @
cf5ab4d5
...
...
@@ -61,8 +61,9 @@ public class WorkFlowServiceImpl implements WorkFlowService {
@Autowired
private
NodePageService
nodePageService
;
@Value
(
"${file.path}"
)
String
path
;
@Autowired
ClassLoader
classLoader
;
@Override
public
String
saveXml
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
...
...
@@ -77,8 +78,8 @@ public class WorkFlowServiceImpl implements WorkFlowService {
fileName
=
UUID
.
randomUUID
()
+
suffixName
;
System
.
out
.
println
(
fileName
);
//指定本地存入路径
File
fileNew
=
new
File
(
path
+
fileName
);
realPath
=
path
+
fileName
;
File
fileNew
=
new
File
(
classLoader
.
getResource
(
""
).
getPath
()
+
fileName
);
realPath
=
classLoader
.
getResource
(
""
).
getPath
()
+
fileName
;
try
{
file
.
transferTo
(
fileNew
);
}
catch
(
IOException
e
)
{
...
...
@@ -133,8 +134,6 @@ public class WorkFlowServiceImpl implements WorkFlowService {
Long
id
=
flowsInfoVo
.
getId
();
String
flowKey
=
flowsInfoVo
.
getFlowKey
();
String
fileXml
=
flowsInfoVo
.
getFileXml
();
// String flowName = flowsInfoVo.getFlowName();
// String flowDescribe = flowsInfoVo.getFlowDescribe();
List
<
NodePage
>
nodePages
=
flowsInfoVo
.
getNodePages
();
for
(
NodePage
nodePage
:
nodePages
)
{
...
...
@@ -143,7 +142,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
//生成xml文件
File
f
=
null
;
try
{
f
=
new
File
(
path
+
"/xml/"
+
flowKey
+
"bpmn20.xml"
);
f
=
new
File
(
classLoader
.
getResource
(
""
).
getPath
()
+
"/xml/"
+
flowKey
+
"bpmn20.xml"
);
// 判断文件是否存在
if
(!
f
.
exists
()){
f
.
createNewFile
();
...
...
@@ -186,7 +185,7 @@ public class WorkFlowServiceImpl implements WorkFlowService {
flowsInfo
.
setCreateTime
(
new
Date
());
//状态为未部署
flowsInfo
.
setState
(
1
);
flowsInfo
.
setFilePath
(
path
+
"/xml/"
+
flowKey
+
"bpmn20.xml"
);
flowsInfo
.
setFilePath
(
classLoader
.
getResource
(
""
).
getPath
()
+
"/xml/"
+
flowKey
+
"bpmn20.xml"
);
flowsInfo
.
setId
(
id
);
//更新并保存
flowsInfoMapper
.
save
(
flowsInfo
);
...
...
src/main/resources/application.yml
浏览文件 @
cf5ab4d5
spring
:
datasource
:
username
:
root
password
:
Huang123+
url
:
jdbc:mysql://47.106.142.73:3306/www?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8&nullCatalogMeansCurrent=true
driver-class-name
:
com.mysql.cj.jdbc.Driver
jpa
:
show-sql
:
true
hibernate
:
ddl-auto
:
update
\ No newline at end of file
src/test/java/com/tykj/workflowcore/WorkflowCoreApplicationTests.java
deleted
100644 → 0
浏览文件 @
73f175b4
package
com
.
tykj
.
workflowcore
;
import
org.junit.jupiter.api.Test
;
import
org.springframework.boot.test.context.SpringBootTest
;
@SpringBootTest
class
WorkflowCoreApplicationTests
{
@Test
void
contextLoads
()
{
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论