Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4ae2dcd3
authored
Sep 11, 2023
by
tiger
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
sop / tpl
1 parent
bb3aee2e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
36 additions
and
151 deletions
platform-process/src/main/java/cn/com/glsx/process/config/WebConfig.java
platform-process/src/main/java/cn/com/glsx/process/job/DynamicConfig.java
platform-process/src/main/java/cn/com/glsx/process/job/DynamicTaskAdd.java
platform-process/src/main/java/cn/com/glsx/process/job/instance/DynamicJob.java
platform-process/src/main/java/cn/com/glsx/process/modules/api/SopTplApiController.java → platform-process/src/main/java/cn/com/glsx/process/modules/api/SopApiController.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/AdminController.java
platform-process/src/main/java/cn/com/glsx/process/modules/controller/TestJobController.java
platform-process/src/main/resources/application.properties_standalone
platform-process/src/main/java/cn/com/glsx/process/config/WebConfig.java
View file @
4ae2dcd
...
@@ -67,8 +67,6 @@ public class WebConfig implements WebMvcConfigurer {
...
@@ -67,8 +67,6 @@ public class WebConfig implements WebMvcConfigurer {
.
excludePathPatterns
(
"/"
)
.
excludePathPatterns
(
"/"
)
.
excludePathPatterns
(
"/login"
)
.
excludePathPatterns
(
"/login"
)
.
excludePathPatterns
(
"/actuator/**"
)
.
excludePathPatterns
(
"/actuator/**"
)
.
excludePathPatterns
(
"/*.shtml"
)
.
excludePathPatterns
(
"/admin/**"
)
.
excludePathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
"/api/**"
)
.
excludePathPatterns
(
"/sop/**"
)
.
excludePathPatterns
(
"/sop/**"
)
.
excludePathPatterns
(
uploadProperties
.
getFilepath
())
.
excludePathPatterns
(
uploadProperties
.
getFilepath
())
...
...
platform-process/src/main/java/cn/com/glsx/process/job/DynamicConfig.java
View file @
4ae2dcd
package
cn
.
com
.
glsx
.
process
.
job
;
package
cn
.
com
.
glsx
.
process
.
job
;
import
com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration
;
import
com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration
;
import
com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter
;
@Configuration
@Configuration
public
class
DynamicConfig
{
public
class
DynamicConfig
{
@Value
(
"${elaticjob.zookeeper.dynamiczk}"
)
@Value
(
"${elaticjob.zookeeper.dynamiczk}"
)
private
String
dynamiczk
;
private
String
dynamiczk
;
@Value
(
"${elaticjob.zookeeper.namespace}"
)
@Value
(
"${elaticjob.zookeeper.namespace}"
)
private
String
dynamicnamespace
;
private
String
dynamicnamespace
;
@Bean
@Bean
public
ZookeeperConfiguration
zookeeperConfiguration
()
{
public
ZookeeperConfiguration
zookeeperConfiguration
()
{
return
new
ZookeeperConfiguration
(
dynamiczk
,
dynamicnamespace
);
return
new
ZookeeperConfiguration
(
dynamiczk
,
dynamicnamespace
);
}
}
@Bean
(
initMethod
=
"init"
)
@Bean
(
initMethod
=
"init"
)
public
ZookeeperRegistryCenter
zookeeperRegistryCenter
(
ZookeeperConfiguration
zookeeperConfiguration
)
{
public
ZookeeperRegistryCenter
zookeeperRegistryCenter
(
ZookeeperConfiguration
zookeeperConfiguration
)
{
return
new
ZookeeperRegistryCenter
(
zookeeperConfiguration
);
return
new
ZookeeperRegistryCenter
(
zookeeperConfiguration
);
}
}
}
}
platform-process/src/main/java/cn/com/glsx/process/job/DynamicTaskAdd.java
View file @
4ae2dcd
package
cn
.
com
.
glsx
.
process
.
job
;
package
cn
.
com
.
glsx
.
process
.
job
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
com.dangdang.ddframe.job.api.simple.SimpleJob
;
import
com.dangdang.ddframe.job.config.JobCoreConfiguration
;
import
com.dangdang.ddframe.job.config.JobCoreConfiguration
;
import
com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration
;
import
com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration
;
import
com.dangdang.ddframe.job.lite.config.LiteJobConfiguration
;
import
com.dangdang.ddframe.job.lite.config.LiteJobConfiguration
;
import
com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler
;
import
com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler
;
import
com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter
;
import
com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
@Component
@Component
public
class
DynamicTaskAdd
{
public
class
DynamicTaskAdd
{
...
@@ -17,24 +18,21 @@ public class DynamicTaskAdd {
...
@@ -17,24 +18,21 @@ public class DynamicTaskAdd {
/***
/***
* 动态创建定时任务
* 动态创建定时任务
*
* @param jobName:定时任务名称
* @param jobName:定时任务名称
* @param cron:表达式
* @param cron:表达式
* @param shardingTotalCount:分片数量
* @param shardingTotalCount:分片数量
* @param instance:定时任务实例
* @param instance:定时任务实例
* @param parameters:参数
* @param parameters:参数
*/
*/
public
void
create
(
String
jobName
,
String
cron
,
int
shardingTotalCount
,
SimpleJob
instance
,
String
parameters
)
{
public
void
create
(
String
jobName
,
String
cron
,
int
shardingTotalCount
,
SimpleJob
instance
,
String
parameters
)
{
LiteJobConfiguration
.
Builder
builder
=
LiteJobConfiguration
.
newBuilder
(
new
SimpleJobConfiguration
(
LiteJobConfiguration
.
Builder
builder
=
LiteJobConfiguration
.
newBuilder
(
new
SimpleJobConfiguration
(
JobCoreConfiguration
.
newBuilder
(
JobCoreConfiguration
.
newBuilder
(
jobName
,
cron
,
shardingTotalCount
).
jobParameter
(
parameters
).
build
(),
instance
.
getClass
().
getName
()))
jobName
,
.
overwrite
(
true
);
cron
,
shardingTotalCount
).
jobParameter
(
parameters
).
build
(),
instance
.
getClass
().
getName
()
)).
overwrite
(
true
);
LiteJobConfiguration
liteJobConfiguration
=
builder
.
build
();
LiteJobConfiguration
liteJobConfiguration
=
builder
.
build
();
new
SpringJobScheduler
(
instance
,
zookeeperRegistryCenter
,
liteJobConfiguration
).
init
();
new
SpringJobScheduler
(
instance
,
zookeeperRegistryCenter
,
liteJobConfiguration
).
init
();
}
}
}
}
platform-process/src/main/java/cn/com/glsx/process/job/instance/DynamicJob.java
View file @
4ae2dcd
platform-process/src/main/java/cn/com/glsx/process/modules/api/Sop
Tpl
ApiController.java
→
platform-process/src/main/java/cn/com/glsx/process/modules/api/SopApiController.java
View file @
4ae2dcd
...
@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.RestController;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
cn.com.glsx.echocenter.api.EchoCenterFeignClient
;
import
cn.com.glsx.process.modules.model.inst.SopStruct
;
import
cn.com.glsx.process.modules.model.inst.SopStruct
;
import
cn.com.glsx.process.modules.service.SopService
;
import
cn.com.glsx.process.modules.service.SopService
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
...
@@ -20,18 +19,15 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -20,18 +19,15 @@ import lombok.extern.slf4j.Slf4j;
* @author kome
* @author kome
*/
*/
@Slf4j
@Slf4j
@Tag
(
name
=
"sop
模板
"
)
@Tag
(
name
=
"sop
服务
"
)
@RestController
@RestController
@RequestMapping
(
value
=
"/sop
/sop-tpl
"
)
@RequestMapping
(
value
=
"/sop"
)
@ResponseResultBody
@ResponseResultBody
public
class
Sop
Tpl
ApiController
{
public
class
SopApiController
{
@Resource
@Resource
private
SopService
sopService
;
private
SopService
sopService
;
@Resource
private
EchoCenterFeignClient
echoCenterFeignClient
;
@Operation
(
summary
=
"查询实例"
)
@Operation
(
summary
=
"查询实例"
)
@GetMapping
(
value
=
"/inst/{instId}"
)
@GetMapping
(
value
=
"/inst/{instId}"
)
public
SopStruct
inst
(
@PathVariable
(
"instId"
)
String
instId
)
{
public
SopStruct
inst
(
@PathVariable
(
"instId"
)
String
instId
)
{
...
...
platform-process/src/main/java/cn/com/glsx/process/modules/controller/AdminController.java
deleted
100644 → 0
View file @
bb3aee2
package
cn
.
com
.
glsx
.
process
.
modules
.
controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
/**
* 通用访问拦截匹配
* 创建者 科帮网
* 创建时间 2018年4月3日
*/
@Controller
@RequestMapping
(
value
=
"/admin"
)
public
class
AdminController
{
/**
* 页面跳转
*
* @param url
* @return
*/
@RequestMapping
(
"/{url}.shtml"
)
public
String
page
(
@PathVariable
(
"url"
)
String
url
)
{
return
url
;
}
/**
* 页面跳转(二级目录)
*
* @param module
* @param url
* @return
*/
@RequestMapping
(
"/{module}/{url}.shtml"
)
public
String
page
(
@PathVariable
(
"module"
)
String
module
,
@PathVariable
(
"url"
)
String
url
)
{
return
module
+
"/"
+
url
;
}
}
platform-process/src/main/java/cn/com/glsx/process/modules/controller/TestJobController.java
View file @
4ae2dcd
package
cn
.
com
.
glsx
.
process
.
modules
.
controller
;
package
cn
.
com
.
glsx
.
process
.
modules
.
controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
cn.com.glsx.process.job.DynamicTaskAdd
;
import
cn.com.glsx.process.job.DynamicTaskAdd
;
import
cn.com.glsx.process.job.instance.DynamicJob
;
import
cn.com.glsx.process.job.instance.DynamicJob
;
import
com.glsx.plat.core.annotation.ResponseResultBody
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
@Slf4j
@Slf4j
@Tag
(
name
=
"动态任务(Demo)"
)
@Tag
(
name
=
"动态任务(Demo)"
)
...
@@ -21,9 +26,9 @@ public class TestJobController {
...
@@ -21,9 +26,9 @@ public class TestJobController {
@GetMapping
(
"/jobtest"
)
@GetMapping
(
"/jobtest"
)
@Operation
(
summary
=
"动态任务添加"
,
description
=
"动态任务添加"
)
@Operation
(
summary
=
"动态任务添加"
,
description
=
"动态任务添加"
)
public
void
test
(
@RequestParam
(
"cron"
)
String
cron
)
{
public
void
test
(
@RequestParam
(
"cron"
)
String
cron
)
{
// cron表达式
// cron表达式
dynamicTaskAdd
.
create
(
"job001"
,
cron
,
1
,
new
DynamicJob
(),
"test"
);
dynamicTaskAdd
.
create
(
"job001"
,
cron
,
1
,
new
DynamicJob
(),
"test"
);
}
}
...
...
platform-process/src/main/resources/application.properties_standalone
View file @
4ae2dcd
s
pring.application.name=process
s
erver.port=9823
logging.path=/data/java_log/jetty/${spring.application.name}/${spring.application.name}.log
server.servlet.context-path=/process
#server
# database
server.port=8202
spring.datasource.url=jdbc:mysql://192.168.3.227:3306/platform_process?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&allowMultiQueries=true
server.servlet.context-path=/${spring.application.name}
server.servlet.session.timeout=2592000
server.max-http-header-size=8192
server.tomcat.uri-encoding=UTF-8
server.tomcat.max-threads=1000
server.tomcat.min-spare-threads=30s
server.tomcat.basedir=/temp
#database
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.1.136:3306/sop_process?serverTimeZone=Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=root
spring.datasource.username=root
spring.datasource.password=123456
spring.datasource.password=manager
# Hikari will use the above plus the following to setup connection pooling
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle=5
spring.datasource.hikari.maximum-pool-size=15
spring.datasource.hikari.auto-commit=true
spring.datasource.hikari.idle-timeout=30000
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.max-lifetime=1800000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
spring.data.redis.repositories.enabled = false
#redis config
spring.redis.host=192.168.0.39
spring.redis.port=6379
spring.redis.password=hhxredis
spring.redis.database=1
spring.redis.timeout=200000
#jwt config
jwt.config.header=Authorization
jwt.config.ttl=7200
jwt.config.key=5371f568a45e5ab1f442c38e0932aef24447139c
# session最大超时时间(分钟),默认为30
server.session-timeout=60
# tomcat最大线程数,默认为200
server.tomcat.max-threads=100
# tomcat的URI编码
server.tomcat.uri-encoding=UTF-8
# 静态文件请求匹配方式
spring.mvc.static-path-pattern=/**
#spring.thymeleaf.mode=LEGACYHTML5
#spring boot 2.x 参数变化
spring.thymeleaf.mode=HTML
#dev tools
spring.devtools.livereload.enabled=true
spring.thymeleaf.cache=false
spring.thymeleaf.cache-period=0
spring.thymeleaf.template.cache=false
# quartz任务配置
spring.quartz.job-store-type=jdbc
spring.quartz.properties.org.quartz.scheduler.instanceName=clusteredScheduler
spring.quartz.properties.org.quartz.scheduler.instanceId=AUTO
spring.quartz.properties.org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
spring.quartz.properties.org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
spring.quartz.properties.org.quartz.jobStore.dataSource=quartzDataSource
spring.quartz.properties.org.quartz.jobStore.tablePrefix=QRTZ_
# 打开集群配置
spring.quartz.properties.org.quartz.jobStore.isClustered=true
# 设置集群检查间隔100s
spring.quartz.properties.org.quartz.jobStore.clusterCheckinInterval=10000
spring.quartz.properties.org.quartz.jobStore.useProperties=false
spring.quartz.properties.org.quartz.threadPool.class=org.quartz.simpl.SimpleThreadPool
spring.quartz.properties.org.quartz.threadPool.threadCount=10
spring.quartz.properties.org.quartz.threadPool.threadPriority=5
spring.quartz.properties.org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread=true
elaticjob.zookeeper.server-lists=192.168.3.101:2181
elaticjob.zookeeper.dynamiczk=192.168.3.101:2181
elaticjob.zookeeper.namespace=glsx_sop
Write
Preview
Markdown
is supported
Attach a file
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 post a comment