提交 dbb4adf6 编写于 作者: C CalvinKirs

Merge remote-tracking branch 'upstream/dev' into task-end

# Conflicts:
#	.asf.yaml
#	dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/FuncUtils.java
#	dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java
#	dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/SchedulerController.java
#	dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
#	dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
#	dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/AlertGroupControllerTest.java
#	dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorService2Test.java
#	dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
#	dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/enums/StateEventType.java
#	dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/Command.java
#	dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ErrorCommand.java
#	dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/ProcessInstance.java
#	dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java
#	dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ScheduleMapper.xml
#	dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionLogMapper.xml
#	dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.xml
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/ConditionsTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/DependentTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/CommonTaskProcessor.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/ConditionTaskProcessor.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/task/DependentTaskProcessor.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/WorkerServer.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/ConditionsTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/DependentTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/MasterBaseTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/MasterTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/SubProcessTaskExecThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/python/PythonTask.java
#	dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTask.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/WorkflowExecuteThreadTest.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessorTest.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThreadTest.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThreadTest.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/PythonCommandExecutorTest.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/http/HttpTaskTest.java
#	dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/task/sql/SqlTaskTest.java
#	dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
#	dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/quartz/cron/CronUtils.java
#	dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java
#	dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/DolphinSchedulerPlugin.java
#	dolphinscheduler-standalone-server/pom.xml
#	dolphinscheduler-standalone-server/src/main/java/org/apache/dolphinscheduler/server/StandaloneServer.java
#	dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/ShellCommandExecutor.java
#	dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTaskChannelFactory.java
#	dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonCommandExecutor.java
#	dolphinscheduler-task-plugin/dolphinscheduler-task-shell/src/main/java/org/apache/dolphinscheduler/plugin/task/shell/ShellTask.java
#	dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java
#	dolphinscheduler-task-plugin/dolphinscheduler-task-sqoop/src/main/java/org/apache/dolphinscheduler/plugin/task/sqoop/SqoopTask.java
#	dolphinscheduler-ui/package.json
#	dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
#	dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
#	dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/formModel.vue
#	sql/dolphinscheduler_h2.sql
...@@ -36,7 +36,7 @@ github: ...@@ -36,7 +36,7 @@ github:
- data-schedule - data-schedule
enabled_merge_buttons: enabled_merge_buttons:
squash: true squash: true
merge: false merge: true
rebase: false rebase: false
protected_branches: protected_branches:
dev: dev:
......
Subproject commit 8c4d3b8ead41812bbe837dc5dfb8fa047cd2b548
...@@ -37,6 +37,7 @@ config.gypi ...@@ -37,6 +37,7 @@ config.gypi
test/coverage test/coverage
/docs/zh_CN/介绍 /docs/zh_CN/介绍
/docs/zh_CN/贡献代码.md /docs/zh_CN/贡献代码.md
dolphinscheduler-common/src/main/resources/zookeeper.properties
dolphinscheduler-dao/src/main/resources/dao/data_source.properties dolphinscheduler-dao/src/main/resources/dao/data_source.properties
dolphinscheduler-alert/logs/ dolphinscheduler-alert/logs/
dolphinscheduler-alert/src/main/resources/alert.properties_bak dolphinscheduler-alert/src/main/resources/alert.properties_bak
......
...@@ -18,13 +18,12 @@ ...@@ -18,13 +18,12 @@
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
<conversionRule conversionWord="message" converterClass="org.apache.dolphinscheduler.service.log.SensitiveDataConverter">
</conversionRule>
<property name="log.base" value="logs"/> <property name="log.base" value="logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
...@@ -39,7 +38,7 @@ ...@@ -39,7 +38,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
......
...@@ -18,13 +18,12 @@ ...@@ -18,13 +18,12 @@
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
<conversionRule conversionWord="message" converterClass="org.apache.dolphinscheduler.service.log.SensitiveDataConverter">
</conversionRule>
<property name="log.base" value="logs"/> <property name="log.base" value="logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
...@@ -43,7 +42,7 @@ ...@@ -43,7 +42,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
......
...@@ -18,18 +18,19 @@ ...@@ -18,18 +18,19 @@
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
<conversionRule conversionWord="message" converterClass="org.apache.dolphinscheduler.service.log.SensitiveDataConverter">
</conversionRule>
<property name="log.base" value="logs"/> <property name="log.base" value="logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
</appender> </appender>
<conversionRule conversionWord="messsage"
converterClass="org.apache.dolphinscheduler.server.log.SensitiveDataConverter"/>
<appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender"> <appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level> <level>INFO</level>
...@@ -44,7 +45,7 @@ ...@@ -44,7 +45,7 @@
<file>${log.base}/${taskAppId}.log</file> <file>${log.base}/${taskAppId}.log</file>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
...@@ -65,7 +66,7 @@ ...@@ -65,7 +66,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
......
...@@ -18,19 +18,20 @@ ...@@ -18,19 +18,20 @@
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
<conversionRule conversionWord="message" converterClass="org.apache.dolphinscheduler.service.log.SensitiveDataConverter">
</conversionRule>
<property name="log.base" value="logs"/> <property name="log.base" value="logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
</appender> </appender>
<!-- worker server logback config start --> <!-- worker server logback config start -->
<conversionRule conversionWord="messsage"
converterClass="org.apache.dolphinscheduler.server.log.SensitiveDataConverter"/>
<appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender"> <appender name="TASKLOGFILE" class="ch.qos.logback.classic.sift.SiftingAppender">
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>INFO</level> <level>INFO</level>
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
<file>${log.base}/${taskAppId}.log</file> <file>${log.base}/${taskAppId}.log</file>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
...@@ -65,7 +66,7 @@ ...@@ -65,7 +66,7 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %messsage%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
......
...@@ -68,7 +68,7 @@ spec: ...@@ -68,7 +68,7 @@ spec:
- name: TZ - name: TZ
value: {{ .Values.timezone }} value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.zookeeper.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}
envFrom: envFrom:
- configMapRef: - configMapRef:
......
...@@ -65,7 +65,7 @@ spec: ...@@ -65,7 +65,7 @@ spec:
- name: TZ - name: TZ
value: {{ .Values.timezone }} value: {{ .Values.timezone }}
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.zookeeper.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}
envFrom: envFrom:
- configMapRef: - configMapRef:
......
...@@ -69,7 +69,7 @@ spec: ...@@ -69,7 +69,7 @@ spec:
- name: ALERT_LISTEN_HOST - name: ALERT_LISTEN_HOST
value: {{ include "dolphinscheduler.fullname" . }}-alert value: {{ include "dolphinscheduler.fullname" . }}-alert
{{- include "dolphinscheduler.database.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.database.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.registry.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.zookeeper.env_vars" . | nindent 12 }}
{{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }} {{- include "dolphinscheduler.fs_s3a.env_vars" . | nindent 12 }}
envFrom: envFrom:
- configMapRef: - configMapRef:
......
...@@ -27,7 +27,7 @@ image: ...@@ -27,7 +27,7 @@ image:
pullPolicy: "IfNotPresent" pullPolicy: "IfNotPresent"
pullSecret: "" pullSecret: ""
## If not exists external database, the postgresql database will be used by default. ## If not exists external database, by default, Dolphinscheduler's database will use it.
postgresql: postgresql:
enabled: true enabled: true
postgresqlUsername: "root" postgresqlUsername: "root"
...@@ -38,7 +38,8 @@ postgresql: ...@@ -38,7 +38,8 @@ postgresql:
size: "20Gi" size: "20Gi"
storageClass: "-" storageClass: "-"
## If exists external database and set postgresql.enable value to false, the external database will be used. ## If exists external database, and set postgresql.enable value to false.
## external database will be used, otherwise Dolphinscheduler's database will be used.
externalDatabase: externalDatabase:
type: "postgresql" type: "postgresql"
driver: "org.postgresql.Driver" driver: "org.postgresql.Driver"
...@@ -49,7 +50,7 @@ externalDatabase: ...@@ -49,7 +50,7 @@ externalDatabase:
database: "dolphinscheduler" database: "dolphinscheduler"
params: "characterEncoding=utf8" params: "characterEncoding=utf8"
## If not exists external registry, the zookeeper registry will be used by default. ## If not exists external zookeeper, by default, Dolphinscheduler's zookeeper will use it.
zookeeper: zookeeper:
enabled: true enabled: true
fourlwCommandsWhitelist: "srvr,ruok,wchs,cons" fourlwCommandsWhitelist: "srvr,ruok,wchs,cons"
...@@ -57,12 +58,13 @@ zookeeper: ...@@ -57,12 +58,13 @@ zookeeper:
enabled: false enabled: false
size: "20Gi" size: "20Gi"
storageClass: "-" storageClass: "-"
zookeeperRoot: "/dolphinscheduler"
## If exists external registry and set zookeeper.enable value to false, the external registry will be used. ## If exists external zookeeper, and set zookeeper.enable value to false.
externalRegistry: ## If zookeeper.enable is false, Dolphinscheduler's zookeeper will use it.
registryPluginDir: "lib/plugin/registry" externalZookeeper:
registryPluginName: "zookeeper" zookeeperQuorum: "127.0.0.1:2181"
registryServers: "127.0.0.1:2181" zookeeperRoot: "/dolphinscheduler"
common: common:
## Configmap ## Configmap
......
...@@ -18,13 +18,12 @@ ...@@ -18,13 +18,12 @@
<!-- Logback configuration. See http://logback.qos.ch/manual/index.html --> <!-- Logback configuration. See http://logback.qos.ch/manual/index.html -->
<configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" --> <configuration scan="true" scanPeriod="120 seconds"> <!--debug="true" -->
<conversionRule conversionWord="message" converterClass="org.apache.dolphinscheduler.service.log.SensitiveDataConverter">
</conversionRule>
<property name="log.base" value="logs"/> <property name="log.base" value="logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
...@@ -39,13 +38,14 @@ ...@@ -39,13 +38,14 @@
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<pattern> <pattern>
[%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %message%n [%level] %date{yyyy-MM-dd HH:mm:ss.SSS} %logger{96}:[%line] - %msg%n
</pattern> </pattern>
<charset>UTF-8</charset> <charset>UTF-8</charset>
</encoder> </encoder>
</appender> </appender>
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT"/>
<appender-ref ref="ALERTLOGFILE"/> <appender-ref ref="ALERTLOGFILE"/>
</root> </root>
......
...@@ -35,8 +35,11 @@ import java.util.Map; ...@@ -35,8 +35,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -49,12 +52,13 @@ import io.swagger.annotations.ApiImplicitParams; ...@@ -49,12 +52,13 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
/** /**
* access token controller * access token controller
*/ */
@Api(tags = "ACCESS_TOKEN_TAG") @Api(tags = "ACCESS_TOKEN_TAG")
@RestController @RestController
@RequestMapping("/access-token") @RequestMapping("/access-tokens")
public class AccessTokenController extends BaseController { public class AccessTokenController extends BaseController {
@Autowired @Autowired
...@@ -70,7 +74,7 @@ public class AccessTokenController extends BaseController { ...@@ -70,7 +74,7 @@ public class AccessTokenController extends BaseController {
* @return create result state code * @return create result state code
*/ */
@ApiIgnore @ApiIgnore
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_ACCESS_TOKEN_ERROR) @ApiException(CREATE_ACCESS_TOKEN_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -118,7 +122,7 @@ public class AccessTokenController extends BaseController { ...@@ -118,7 +122,7 @@ public class AccessTokenController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR) @ApiException(QUERY_ACCESSTOKEN_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -144,12 +148,12 @@ public class AccessTokenController extends BaseController { ...@@ -144,12 +148,12 @@ public class AccessTokenController extends BaseController {
* @return delete result code * @return delete result code
*/ */
@ApiIgnore @ApiIgnore
@PostMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_ACCESS_TOKEN_ERROR) @ApiException(DELETE_ACCESS_TOKEN_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result delAccessTokenById(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id); Map<String, Object> result = accessTokenService.delAccessTokenById(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
...@@ -166,12 +170,12 @@ public class AccessTokenController extends BaseController { ...@@ -166,12 +170,12 @@ public class AccessTokenController extends BaseController {
* @return update result code * @return update result code
*/ */
@ApiIgnore @ApiIgnore
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_ACCESS_TOKEN_ERROR) @ApiException(UPDATE_ACCESS_TOKEN_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateToken(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id, @PathVariable(value = "id") int id,
@RequestParam(value = "userId") int userId, @RequestParam(value = "userId") int userId,
@RequestParam(value = "expireTime") String expireTime, @RequestParam(value = "expireTime") String expireTime,
@RequestParam(value = "token") String token) { @RequestParam(value = "token") String token) {
......
...@@ -39,8 +39,11 @@ import org.slf4j.Logger; ...@@ -39,8 +39,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -58,7 +61,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -58,7 +61,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "ALERT_GROUP_TAG") @Api(tags = "ALERT_GROUP_TAG")
@RestController @RestController
@RequestMapping("alert-group") @RequestMapping("/alert-groups")
public class AlertGroupController extends BaseController { public class AlertGroupController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AlertGroupController.class); private static final Logger logger = LoggerFactory.getLogger(AlertGroupController.class);
...@@ -81,7 +84,7 @@ public class AlertGroupController extends BaseController { ...@@ -81,7 +84,7 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"),
@ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_ALERT_GROUP_ERROR) @ApiException(CREATE_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -125,7 +128,7 @@ public class AlertGroupController extends BaseController { ...@@ -125,7 +128,7 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LIST_PAGING_ALERT_GROUP_ERROR) @ApiException(LIST_PAGING_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -163,6 +166,7 @@ public class AlertGroupController extends BaseController { ...@@ -163,6 +166,7 @@ public class AlertGroupController extends BaseController {
} }
/** /**
* updateProcessInstance alert group * updateProcessInstance alert group
* *
...@@ -179,12 +183,12 @@ public class AlertGroupController extends BaseController { ...@@ -179,12 +183,12 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParam(name = "description", value = "DESC", dataType = "String"), @ApiImplicitParam(name = "description", value = "DESC", dataType = "String"),
@ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String") @ApiImplicitParam(name = "alertInstanceIds", value = "alertInstanceIds", required = true, dataType = "String")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_ALERT_GROUP_ERROR) @ApiException(UPDATE_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateAlertgroup(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateAlertgroup(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id, @PathVariable(value = "id") int id,
@RequestParam(value = "groupName") String groupName, @RequestParam(value = "groupName") String groupName,
@RequestParam(value = "description", required = false) String description, @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "alertInstanceIds") String alertInstanceIds) { @RequestParam(value = "alertInstanceIds") String alertInstanceIds) {
...@@ -204,12 +208,12 @@ public class AlertGroupController extends BaseController { ...@@ -204,12 +208,12 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "ALERT_GROUP_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_ALERT_GROUP_ERROR) @ApiException(DELETE_ALERT_GROUP_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delAlertgroupById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result delAlertgroupById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = alertGroupService.delAlertgroupById(loginUser, id); Map<String, Object> result = alertGroupService.delAlertgroupById(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
...@@ -226,7 +230,7 @@ public class AlertGroupController extends BaseController { ...@@ -226,7 +230,7 @@ public class AlertGroupController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "groupName", value = "GROUP_NAME", required = true, dataType = "String"),
}) })
@GetMapping(value = "/verify-group-name") @GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
......
...@@ -38,8 +38,11 @@ import org.slf4j.Logger; ...@@ -38,8 +38,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -57,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -57,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "ALERT_PLUGIN_INSTANCE_TAG") @Api(tags = "ALERT_PLUGIN_INSTANCE_TAG")
@RestController @RestController
@RequestMapping("alert-plugin-instance") @RequestMapping("alert-plugin-instances")
public class AlertPluginInstanceController extends BaseController { public class AlertPluginInstanceController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(AlertPluginInstanceController.class); private static final Logger logger = LoggerFactory.getLogger(AlertPluginInstanceController.class);
...@@ -81,7 +84,7 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -81,7 +84,7 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"),
@ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(CREATE_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -97,7 +100,7 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -97,7 +100,7 @@ public class AlertPluginInstanceController extends BaseController {
* updateAlertPluginInstance * updateAlertPluginInstance
* *
* @param loginUser login user * @param loginUser login user
* @param alertPluginInstanceId alert plugin instance id * @param id alert plugin instance id
* @param instanceName instance name * @param instanceName instance name
* @param pluginInstanceParams instance params * @param pluginInstanceParams instance params
* @return result * @return result
...@@ -108,15 +111,15 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -108,15 +111,15 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"), @ApiImplicitParam(name = "instanceName", value = "ALERT_PLUGIN_INSTANCE_NAME", required = true, dataType = "String", example = "DING TALK"),
@ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS") @ApiImplicitParam(name = "pluginInstanceParams", value = "ALERT_PLUGIN_INSTANCE_PARAMS", required = true, dataType = "String", example = "ALERT_PLUGIN_INSTANCE_PARAMS")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(UPDATE_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "alertPluginInstanceId") int alertPluginInstanceId, @PathVariable(value = "id") int id,
@RequestParam(value = "instanceName") String instanceName, @RequestParam(value = "instanceName") String instanceName,
@RequestParam(value = "pluginInstanceParams") String pluginInstanceParams) { @RequestParam(value = "pluginInstanceParams") String pluginInstanceParams) {
Map<String, Object> result = alertPluginInstanceService.update(loginUser, alertPluginInstanceId, instanceName, pluginInstanceParams); Map<String, Object> result = alertPluginInstanceService.update(loginUser, id, instanceName, pluginInstanceParams);
return returnDataList(result); return returnDataList(result);
} }
...@@ -131,12 +134,12 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -131,12 +134,12 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "ALERT_PLUGIN_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(DELETE_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = alertPluginInstanceService.delete(loginUser, id); Map<String, Object> result = alertPluginInstanceService.delete(loginUser, id);
return returnDataList(result); return returnDataList(result);
...@@ -150,12 +153,12 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -150,12 +153,12 @@ public class AlertPluginInstanceController extends BaseController {
* @return result * @return result
*/ */
@ApiOperation(value = "getAlertPluginInstance", notes = "GET_ALERT_PLUGIN_INSTANCE_NOTES") @ApiOperation(value = "getAlertPluginInstance", notes = "GET_ALERT_PLUGIN_INSTANCE_NOTES")
@PostMapping(value = "/get") @GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(GET_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(GET_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result getAlertPluginInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) { @PathVariable(value = "id") int id) {
Map<String, Object> result = alertPluginInstanceService.get(loginUser, id); Map<String, Object> result = alertPluginInstanceService.get(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
...@@ -166,8 +169,8 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -166,8 +169,8 @@ public class AlertPluginInstanceController extends BaseController {
* @param loginUser login user * @param loginUser login user
* @return result * @return result
*/ */
@ApiOperation(value = "queryAllAlertPluginInstance", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES") @ApiOperation(value = "queryAlertPluginInstanceList", notes = "QUERY_ALL_ALERT_PLUGIN_INSTANCE_NOTES")
@PostMapping(value = "/queryAll") @GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -187,7 +190,7 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -187,7 +190,7 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "alertInstanceName", value = "ALERT_INSTANCE_NAME", required = true, dataType = "String"),
}) })
@GetMapping(value = "/verify-alert-instance-name") @GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result verifyGroupName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
...@@ -219,7 +222,7 @@ public class AlertPluginInstanceController extends BaseController { ...@@ -219,7 +222,7 @@ public class AlertPluginInstanceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR) @ApiException(LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
......
...@@ -240,6 +240,7 @@ public class BaseController { ...@@ -240,6 +240,7 @@ public class BaseController {
/** /**
* get result * get result
*
* @param msg message * @param msg message
* @param list object list * @param list object list
* @return result code * @return result code
......
...@@ -64,14 +64,14 @@ public class DataAnalysisController extends BaseController { ...@@ -64,14 +64,14 @@ public class DataAnalysisController extends BaseController {
* @param loginUser login user * @param loginUser login user
* @param startDate count start date * @param startDate count start date
* @param endDate count end date * @param endDate count end date
* @param projectId project id * @param projectCode project code
* @return task instance count data * @return task instance count data
*/ */
@ApiOperation(value = "countTaskState", notes = "COUNT_TASK_STATE_NOTES") @ApiOperation(value = "countTaskState", notes = "COUNT_TASK_STATE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "startDate", value = "START_DATE", dataType = "String"), @ApiImplicitParam(name = "startDate", value = "START_DATE", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "END_DATE", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "END_DATE", dataType = "String"),
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType = "Int", example = "100") @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "100")
}) })
@GetMapping(value = "/task-state-count") @GetMapping(value = "/task-state-count")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
...@@ -80,9 +80,9 @@ public class DataAnalysisController extends BaseController { ...@@ -80,9 +80,9 @@ public class DataAnalysisController extends BaseController {
public Result countTaskState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result countTaskState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate, @RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectId", required = false, defaultValue = "0") int projectId) { @RequestParam(value = "projectCode", required = false, defaultValue = "0") long projectCode) {
Map<String, Object> result = dataAnalysisService.countTaskStateByProject(loginUser, projectId, startDate, endDate); Map<String, Object> result = dataAnalysisService.countTaskStateByProject(loginUser, projectCode, startDate, endDate);
return returnDataList(result); return returnDataList(result);
} }
...@@ -92,14 +92,14 @@ public class DataAnalysisController extends BaseController { ...@@ -92,14 +92,14 @@ public class DataAnalysisController extends BaseController {
* @param loginUser login user * @param loginUser login user
* @param startDate start date * @param startDate start date
* @param endDate end date * @param endDate end date
* @param projectId project id * @param projectCode project code
* @return process instance data * @return process instance data
*/ */
@ApiOperation(value = "countProcessInstanceState", notes = "COUNT_PROCESS_INSTANCE_NOTES") @ApiOperation(value = "countProcessInstanceState", notes = "COUNT_PROCESS_INSTANCE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "startDate", value = "START_DATE", dataType = "String"), @ApiImplicitParam(name = "startDate", value = "START_DATE", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "END_DATE", dataType = "String"), @ApiImplicitParam(name = "endDate", value = "END_DATE", dataType = "String"),
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType = "Int", example = "100") @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "100")
}) })
@GetMapping(value = "/process-state-count") @GetMapping(value = "/process-state-count")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
...@@ -108,9 +108,9 @@ public class DataAnalysisController extends BaseController { ...@@ -108,9 +108,9 @@ public class DataAnalysisController extends BaseController {
public Result countProcessInstanceState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result countProcessInstanceState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "startDate", required = false) String startDate, @RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate, @RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectId", required = false, defaultValue = "0") int projectId) { @RequestParam(value = "projectCode", required = false, defaultValue = "0") long projectCode) {
Map<String, Object> result = dataAnalysisService.countProcessInstanceStateByProject(loginUser, projectId, startDate, endDate); Map<String, Object> result = dataAnalysisService.countProcessInstanceStateByProject(loginUser, projectCode, startDate, endDate);
return returnDataList(result); return returnDataList(result);
} }
...@@ -118,50 +118,38 @@ public class DataAnalysisController extends BaseController { ...@@ -118,50 +118,38 @@ public class DataAnalysisController extends BaseController {
* statistics the process definition quantities of certain person * statistics the process definition quantities of certain person
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param projectCode project code
* @return definition count in project id * @return definition count in project code
*/ */
@ApiOperation(value = "countDefinitionByUser", notes = "COUNT_PROCESS_DEFINITION_BY_USER_NOTES") @ApiOperation(value = "countDefinitionByUser", notes = "COUNT_PROCESS_DEFINITION_BY_USER_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType = "Int", example = "100") @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "100")
}) })
@GetMapping(value = "/define-user-count") @GetMapping(value = "/define-user-count")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(COUNT_PROCESS_DEFINITION_USER_ERROR) @ApiException(COUNT_PROCESS_DEFINITION_USER_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result countDefinitionByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result countDefinitionByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "projectId", required = false, defaultValue = "0") int projectId) { @RequestParam(value = "projectCode", required = false, defaultValue = "0") long projectCode) {
Map<String, Object> result = dataAnalysisService.countDefinitionByUser(loginUser, projectId); Map<String, Object> result = dataAnalysisService.countDefinitionByUser(loginUser, projectCode);
return returnDataList(result); return returnDataList(result);
} }
/** /**
* statistical command status data * statistical command status data
* *
* @param loginUser login user * @param loginUser login user
* @param startDate start date * @return command state of user projects
* @param endDate end date
* @param projectId project id
* @return command state in project id
*/ */
@ApiOperation(value = "countCommandState", notes = "COUNT_COMMAND_STATE_NOTES") @ApiOperation(value = "countCommandState", notes = "COUNT_COMMAND_STATE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "startDate", value = "START_DATE", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "END_DATE", dataType = "String"),
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/command-state-count") @GetMapping(value = "/command-state-count")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(COMMAND_STATE_COUNT_ERROR) @ApiException(COMMAND_STATE_COUNT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result countCommandState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result countCommandState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "projectId", required = false, defaultValue = "0") int projectId) {
Map<String, Object> result = dataAnalysisService.countCommandState(loginUser, projectId, startDate, endDate); Map<String, Object> result = dataAnalysisService.countCommandState(loginUser);
return returnDataList(result); return returnDataList(result);
} }
...@@ -169,21 +157,16 @@ public class DataAnalysisController extends BaseController { ...@@ -169,21 +157,16 @@ public class DataAnalysisController extends BaseController {
* queue count * queue count
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id
* @return queue state count * @return queue state count
*/ */
@ApiOperation(value = "countQueueState", notes = "COUNT_QUEUE_STATE_NOTES") @ApiOperation(value = "countQueueState", notes = "COUNT_QUEUE_STATE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", dataType = "Int", example = "100")
})
@GetMapping(value = "/queue-count") @GetMapping(value = "/queue-count")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUEUE_COUNT_ERROR) @ApiException(QUEUE_COUNT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result countQueueState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result countQueueState(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
@RequestParam(value = "projectId", required = false, defaultValue = "0") int projectId) {
Map<String, Object> result = dataAnalysisService.countQueueState(loginUser, projectId); Map<String, Object> result = dataAnalysisService.countQueueState(loginUser);
return returnDataList(result); return returnDataList(result);
} }
} }
...@@ -46,8 +46,11 @@ import java.util.Map; ...@@ -46,8 +46,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -81,7 +84,7 @@ public class DataSourceController extends BaseController { ...@@ -81,7 +84,7 @@ public class DataSourceController extends BaseController {
* @return create result code * @return create result code
*/ */
@ApiOperation(value = "createDataSource", notes = "CREATE_DATA_SOURCE_NOTES") @ApiOperation(value = "createDataSource", notes = "CREATE_DATA_SOURCE_NOTES")
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_DATASOURCE_ERROR) @ApiException(CREATE_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -96,19 +99,23 @@ public class DataSourceController extends BaseController { ...@@ -96,19 +99,23 @@ public class DataSourceController extends BaseController {
* updateProcessInstance data source * updateProcessInstance data source
* *
* @param loginUser login user * @param loginUser login user
* @param id datasource id
* @param dataSourceParam datasource param * @param dataSourceParam datasource param
* @return update result code * @return update result code
*/ */
@ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES") @ApiOperation(value = "updateDataSource", notes = "UPDATE_DATA_SOURCE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Integer"),
@ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_DATASOURCE_ERROR) @ApiException(UPDATE_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@PathVariable(value = "id") Integer id,
@RequestBody BaseDataSourceParamDTO dataSourceParam) { @RequestBody BaseDataSourceParamDTO dataSourceParam) {
dataSourceParam.setId(id);
return dataSourceService.updateDataSource(dataSourceParam.getId(), loginUser, dataSourceParam); return dataSourceService.updateDataSource(dataSourceParam.getId(), loginUser, dataSourceParam);
} }
...@@ -124,12 +131,12 @@ public class DataSourceController extends BaseController { ...@@ -124,12 +131,12 @@ public class DataSourceController extends BaseController {
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/update-ui") @GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR) @ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryDataSource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
Map<String, Object> result = dataSourceService.queryDataSource(id); Map<String, Object> result = dataSourceService.queryDataSource(id);
return returnDataList(result); return returnDataList(result);
...@@ -171,7 +178,7 @@ public class DataSourceController extends BaseController { ...@@ -171,7 +178,7 @@ public class DataSourceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_ERROR) @ApiException(QUERY_DATASOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -196,7 +203,7 @@ public class DataSourceController extends BaseController { ...@@ -196,7 +203,7 @@ public class DataSourceController extends BaseController {
*/ */
@ApiOperation(value = "connectDataSource", notes = "CONNECT_DATA_SOURCE_NOTES") @ApiOperation(value = "connectDataSource", notes = "CONNECT_DATA_SOURCE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO"), @ApiImplicitParam(name = "dataSourceParam", value = "DATA_SOURCE_PARAM", required = true, dataType = "BaseDataSourceParamDTO")
}) })
@PostMapping(value = "/connect") @PostMapping(value = "/connect")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
...@@ -220,12 +227,12 @@ public class DataSourceController extends BaseController { ...@@ -220,12 +227,12 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/connect-by-id") @GetMapping(value = "/{id}/connect-test")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(CONNECTION_TEST_FAILURE) @ApiException(CONNECTION_TEST_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result connectionTest(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
return dataSourceService.connectionTest(id); return dataSourceService.connectionTest(id);
} }
...@@ -240,12 +247,12 @@ public class DataSourceController extends BaseController { ...@@ -240,12 +247,12 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "DATA_SOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_DATA_SOURCE_FAILURE) @ApiException(DELETE_DATA_SOURCE_FAILURE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result delete(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result delete(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
return dataSourceService.delete(loginUser, id); return dataSourceService.delete(loginUser, id);
} }
...@@ -282,7 +289,7 @@ public class DataSourceController extends BaseController { ...@@ -282,7 +289,7 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/unauth-datasource") @GetMapping(value = "/unauth")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UNAUTHORIZED_DATASOURCE) @ApiException(UNAUTHORIZED_DATASOURCE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -305,7 +312,7 @@ public class DataSourceController extends BaseController { ...@@ -305,7 +312,7 @@ public class DataSourceController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/authed-datasource") @GetMapping(value = "/authed")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(AUTHORIZED_DATA_SOURCE) @ApiException(AUTHORIZED_DATA_SOURCE)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
......
...@@ -60,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -60,7 +60,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "EXECUTOR_TAG") @Api(tags = "EXECUTOR_TAG")
@RestController @RestController
@RequestMapping("projects/{projectName}/executors") @RequestMapping("projects/{projectCode}/executors")
public class ExecutorController extends BaseController { public class ExecutorController extends BaseController {
@Autowired @Autowired
...@@ -70,8 +70,8 @@ public class ExecutorController extends BaseController { ...@@ -70,8 +70,8 @@ public class ExecutorController extends BaseController {
* execute process instance * execute process instance
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionId process definition id * @param processDefinitionCode process definition code
* @param scheduleTime schedule time * @param scheduleTime schedule time
* @param failureStrategy failure strategy * @param failureStrategy failure strategy
* @param startNodeList start nodes list * @param startNodeList start nodes list
...@@ -88,7 +88,7 @@ public class ExecutorController extends BaseController { ...@@ -88,7 +88,7 @@ public class ExecutorController extends BaseController {
*/ */
@ApiOperation(value = "startProcessInstance", notes = "RUN_PROCESS_INSTANCE_NOTES") @ApiOperation(value = "startProcessInstance", notes = "RUN_PROCESS_INSTANCE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100"),
@ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", required = true, dataType = "String"), @ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", required = true, dataType = "String"),
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", required = true, dataType = "FailureStrategy"), @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", required = true, dataType = "FailureStrategy"),
@ApiImplicitParam(name = "startNodeList", value = "START_NODE_LIST", dataType = "String"), @ApiImplicitParam(name = "startNodeList", value = "START_NODE_LIST", dataType = "String"),
...@@ -108,8 +108,8 @@ public class ExecutorController extends BaseController { ...@@ -108,8 +108,8 @@ public class ExecutorController extends BaseController {
@ApiException(START_PROCESS_INSTANCE_ERROR) @ApiException(START_PROCESS_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result startProcessInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result startProcessInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "processDefinitionId") int processDefinitionId, @RequestParam(value = "processDefinitionCode") long processDefinitionCode,
@RequestParam(value = "scheduleTime", required = false) String scheduleTime, @RequestParam(value = "scheduleTime", required = false) String scheduleTime,
@RequestParam(value = "failureStrategy", required = true) FailureStrategy failureStrategy, @RequestParam(value = "failureStrategy", required = true) FailureStrategy failureStrategy,
@RequestParam(value = "startNodeList", required = false) String startNodeList, @RequestParam(value = "startNodeList", required = false) String startNodeList,
...@@ -123,8 +123,7 @@ public class ExecutorController extends BaseController { ...@@ -123,8 +123,7 @@ public class ExecutorController extends BaseController {
@RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode, @RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode,
@RequestParam(value = "timeout", required = false) Integer timeout, @RequestParam(value = "timeout", required = false) Integer timeout,
@RequestParam(value = "startParams", required = false) String startParams, @RequestParam(value = "startParams", required = false) String startParams,
@RequestParam(value = "expectedParallelismNumber", required = false) Integer expectedParallelismNumber @RequestParam(value = "expectedParallelismNumber", required = false) Integer expectedParallelismNumber) {
) {
if (timeout == null) { if (timeout == null) {
timeout = Constants.MAX_TASK_TIMEOUT; timeout = Constants.MAX_TASK_TIMEOUT;
...@@ -133,18 +132,16 @@ public class ExecutorController extends BaseController { ...@@ -133,18 +132,16 @@ public class ExecutorController extends BaseController {
if (startParams != null) { if (startParams != null) {
startParamMap = JSONUtils.toMap(startParams); startParamMap = JSONUtils.toMap(startParams);
} }
Map<String, Object> result = execService.execProcessInstance(loginUser, projectName, processDefinitionId, scheduleTime, execType, failureStrategy, Map<String, Object> result = execService.execProcessInstance(loginUser, projectCode, processDefinitionCode, scheduleTime, execType, failureStrategy,
startNodeList, taskDependType, warningType, startNodeList, taskDependType, warningType, warningGroupId, runMode, processInstancePriority, workerGroup, environmentCode,timeout, startParamMap, expectedParallelismNumber);
warningGroupId, runMode, processInstancePriority, workerGroup, environmentCode, timeout, startParamMap, expectedParallelismNumber);
return returnDataList(result); return returnDataList(result);
} }
/** /**
* do action to process instance:pause, stop, repeat, recover from pause, recover from stop * do action to process instance:pause, stop, repeat, recover from pause, recover from stop
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processInstanceId process instance id * @param processInstanceId process instance id
* @param executeType execute type * @param executeType execute type
* @return execute result code * @return execute result code
...@@ -159,32 +156,30 @@ public class ExecutorController extends BaseController { ...@@ -159,32 +156,30 @@ public class ExecutorController extends BaseController {
@ApiException(EXECUTE_PROCESS_INSTANCE_ERROR) @ApiException(EXECUTE_PROCESS_INSTANCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result execute(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result execute(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("processInstanceId") Integer processInstanceId, @RequestParam("processInstanceId") Integer processInstanceId,
@RequestParam("executeType") ExecuteType executeType @RequestParam("executeType") ExecuteType executeType
) { ) {
Map<String, Object> result = execService.execute(loginUser, projectName, processInstanceId, executeType); Map<String, Object> result = execService.execute(loginUser, projectCode, processInstanceId, executeType);
return returnDataList(result); return returnDataList(result);
} }
/** /**
* check process definition and all of the son process definitions is on line. * check process definition and all of the son process definitions is on line.
* *
* @param loginUser login user * @param processDefinitionCode process definition code
* @param processDefinitionId process definition id
* @return check result code * @return check result code
*/ */
@ApiOperation(value = "startCheckProcessDefinition", notes = "START_CHECK_PROCESS_DEFINITION_NOTES") @ApiOperation(value = "startCheckProcessDefinition", notes = "START_CHECK_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100")
}) })
@PostMapping(value = "/start-check") @PostMapping(value = "/start-check")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(CHECK_PROCESS_DEFINITION_ERROR) @ApiException(CHECK_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result startCheckProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result startCheckProcessDefinition(@RequestParam(value = "processDefinitionCode") long processDefinitionCode) {
@RequestParam(value = "processDefinitionId") int processDefinitionId) { Map<String, Object> result = execService.startCheckByProcessDefinedCode(processDefinitionCode);
Map<String, Object> result = execService.startCheckByProcessDefinedId(processDefinitionId);
return returnDataList(result); return returnDataList(result);
} }
} }
...@@ -102,7 +102,7 @@ public class LoginController extends BaseController { ...@@ -102,7 +102,7 @@ public class LoginController extends BaseController {
// verify username and password // verify username and password
Result<Map<String, String>> result = authenticator.authenticate(userName, userPassword, ip); Result<Map<String, String>> result = authenticator.authenticate(userName, userPassword, ip);
if (result.isFailed()) { if (result.getCode() != Status.SUCCESS.getCode()) {
return result; return result;
} }
......
...@@ -61,7 +61,7 @@ public class MonitorController extends BaseController { ...@@ -61,7 +61,7 @@ public class MonitorController extends BaseController {
* @return master list * @return master list
*/ */
@ApiOperation(value = "listMaster", notes = "MASTER_LIST_NOTES") @ApiOperation(value = "listMaster", notes = "MASTER_LIST_NOTES")
@GetMapping(value = "/master/list") @GetMapping(value = "/masters")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LIST_MASTERS_ERROR) @ApiException(LIST_MASTERS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -77,7 +77,7 @@ public class MonitorController extends BaseController { ...@@ -77,7 +77,7 @@ public class MonitorController extends BaseController {
* @return worker information list * @return worker information list
*/ */
@ApiOperation(value = "listWorker", notes = "WORKER_LIST_NOTES") @ApiOperation(value = "listWorker", notes = "WORKER_LIST_NOTES")
@GetMapping(value = "/worker/list") @GetMapping(value = "/workers")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LIST_WORKERS_ERROR) @ApiException(LIST_WORKERS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -93,7 +93,7 @@ public class MonitorController extends BaseController { ...@@ -93,7 +93,7 @@ public class MonitorController extends BaseController {
* @return data base state * @return data base state
*/ */
@ApiOperation(value = "queryDatabaseState", notes = "QUERY_DATABASE_STATE_NOTES") @ApiOperation(value = "queryDatabaseState", notes = "QUERY_DATABASE_STATE_NOTES")
@GetMapping(value = "/database") @GetMapping(value = "/databases")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATABASE_STATE_ERROR) @ApiException(QUERY_DATABASE_STATE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -109,7 +109,7 @@ public class MonitorController extends BaseController { ...@@ -109,7 +109,7 @@ public class MonitorController extends BaseController {
* @return zookeeper information list * @return zookeeper information list
*/ */
@ApiOperation(value = "queryZookeeperState", notes = "QUERY_ZOOKEEPER_STATE_NOTES") @ApiOperation(value = "queryZookeeperState", notes = "QUERY_ZOOKEEPER_STATE_NOTES")
@GetMapping(value = "/zookeeper/list") @GetMapping(value = "/zookeepers")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_ZOOKEEPER_STATE_ERROR) @ApiException(QUERY_ZOOKEEPER_STATE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
......
...@@ -19,17 +19,15 @@ package org.apache.dolphinscheduler.api.controller; ...@@ -19,17 +19,15 @@ package org.apache.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.IMPORT_PROCESS_DEFINE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_PROJECT; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_PROJECT;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROJECT_DETAILS_BY_ID_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROJECT_DETAILS_BY_CODE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_UNAUTHORIZED_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_UNAUTHORIZED_PROJECT_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROJECT_ERROR;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.Constants;
...@@ -40,14 +38,16 @@ import java.util.Map; ...@@ -40,14 +38,16 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
...@@ -66,9 +66,6 @@ public class ProjectController extends BaseController { ...@@ -66,9 +66,6 @@ public class ProjectController extends BaseController {
@Autowired @Autowired
private ProjectService projectService; private ProjectService projectService;
@Autowired
private ProcessDefinitionService processDefinitionService;
/** /**
* create project * create project
* *
...@@ -77,71 +74,69 @@ public class ProjectController extends BaseController { ...@@ -77,71 +74,69 @@ public class ProjectController extends BaseController {
* @param description description * @param description description
* @return returns an error if it exists * @return returns an error if it exists
*/ */
@ApiOperation(value = "createProject", notes = "CREATE_PROJECT_NOTES") @ApiOperation(value = "create", notes = "CREATE_PROJECT_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "PROJECT_DESC", required = true, dataType = "String") @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_PROJECT_ERROR) @ApiException(CREATE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result createProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectName") String projectName, @RequestParam("projectName") String projectName,
@RequestParam(value = "description", required = false) String description) { @RequestParam(value = "description", required = false) String description) {
Map<String, Object> result = projectService.createProject(loginUser, projectName, description); Map<String, Object> result = projectService.createProject(loginUser, projectName, description);
return returnDataList(result); return returnDataList(result);
} }
/** /**
* updateProcessInstance project * update project
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param code project code
* @param projectName project name * @param projectName project name
* @param description description * @param description description
* @return update result code * @return update result code
*/ */
@ApiOperation(value = "updateProject", notes = "UPDATE_PROJECT_NOTES") @ApiOperation(value = "update", notes = "UPDATE_PROJECT_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456"),
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"), @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"),
@ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "userName", value = "USER_NAME", dataType = "String"),
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROJECT_ERROR) @ApiException(UPDATE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId, @PathVariable("code") Long code,
@RequestParam("projectName") String projectName, @RequestParam("projectName") String projectName,
@RequestParam(value = "description", required = false) String description, @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "userName") String userName) { @RequestParam(value = "userName") String userName) {
Map<String, Object> result = projectService.update(loginUser, projectId, projectName, description, userName); Map<String, Object> result = projectService.update(loginUser, code, projectName, description, userName);
return returnDataList(result); return returnDataList(result);
} }
/** /**
* query project details by id * query project details by code
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param code project code
* @return project detail information * @return project detail information
*/ */
@ApiOperation(value = "queryProjectById", notes = "QUERY_PROJECT_BY_ID_NOTES") @ApiOperation(value = "queryProjectByCode", notes = "QUERY_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456")
}) })
@GetMapping(value = "/query-by-id") @GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROJECT_DETAILS_BY_ID_ERROR) @ApiException(QUERY_PROJECT_DETAILS_BY_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProjectById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryProjectByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId) { @PathVariable("code") long code) {
Map<String, Object> result = projectService.queryByCode(loginUser, code);
Map<String, Object> result = projectService.queryById(projectId);
return returnDataList(result); return returnDataList(result);
} }
...@@ -157,10 +152,10 @@ public class ProjectController extends BaseController { ...@@ -157,10 +152,10 @@ public class ProjectController extends BaseController {
@ApiOperation(value = "queryProjectListPaging", notes = "QUERY_PROJECT_LIST_PAGING_NOTES") @ApiOperation(value = "queryProjectListPaging", notes = "QUERY_PROJECT_LIST_PAGING_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1") @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR) @ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -180,25 +175,23 @@ public class ProjectController extends BaseController { ...@@ -180,25 +175,23 @@ public class ProjectController extends BaseController {
} }
/** /**
* delete project by id * delete project by code
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param code project code
* @return delete result code * @return delete result code
*/ */
@ApiOperation(value = "deleteProjectById", notes = "DELETE_PROJECT_BY_ID_NOTES") @ApiOperation(value = "delete", notes = "DELETE_PROJECT_BY_ID_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "projectId", value = "PROJECT_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456")
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROJECT_ERROR) @ApiException(DELETE_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("projectId") Integer projectId @PathVariable("code") Long code) {
) { Map<String, Object> result = projectService.deleteProject(loginUser, code);
Map<String, Object> result = projectService.deleteProject(loginUser, projectId);
return returnDataList(result); return returnDataList(result);
} }
...@@ -211,9 +204,9 @@ public class ProjectController extends BaseController { ...@@ -211,9 +204,9 @@ public class ProjectController extends BaseController {
*/ */
@ApiOperation(value = "queryUnauthorizedProject", notes = "QUERY_UNAUTHORIZED_PROJECT_NOTES") @ApiOperation(value = "queryUnauthorizedProject", notes = "QUERY_UNAUTHORIZED_PROJECT_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100")
}) })
@GetMapping(value = "/unauth-project") @GetMapping(value = "/unauth")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_UNAUTHORIZED_PROJECT_ERROR) @ApiException(QUERY_UNAUTHORIZED_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -223,7 +216,6 @@ public class ProjectController extends BaseController { ...@@ -223,7 +216,6 @@ public class ProjectController extends BaseController {
return returnDataList(result); return returnDataList(result);
} }
/** /**
* query authorized project * query authorized project
* *
...@@ -233,9 +225,9 @@ public class ProjectController extends BaseController { ...@@ -233,9 +225,9 @@ public class ProjectController extends BaseController {
*/ */
@ApiOperation(value = "queryAuthorizedProject", notes = "QUERY_AUTHORIZED_PROJECT_NOTES") @ApiOperation(value = "queryAuthorizedProject", notes = "QUERY_AUTHORIZED_PROJECT_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100")
}) })
@GetMapping(value = "/authed-project") @GetMapping(value = "/authed")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_AUTHORIZED_PROJECT) @ApiException(QUERY_AUTHORIZED_PROJECT)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -252,7 +244,7 @@ public class ProjectController extends BaseController { ...@@ -252,7 +244,7 @@ public class ProjectController extends BaseController {
* @return projects which the user create and authorized * @return projects which the user create and authorized
*/ */
@ApiOperation(value = "queryProjectCreatedAndAuthorizedByUser", notes = "QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES") @ApiOperation(value = "queryProjectCreatedAndAuthorizedByUser", notes = "QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES")
@GetMapping(value = "/created-and-authorized-project") @GetMapping(value = "/created-and-authed")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR) @ApiException(QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -261,30 +253,6 @@ public class ProjectController extends BaseController { ...@@ -261,30 +253,6 @@ public class ProjectController extends BaseController {
return returnDataList(result); return returnDataList(result);
} }
/**
* import process definition
*
* @param loginUser login user
* @param file resource file
* @param projectName project name
* @return import result code
*/
@ApiOperation(value = "importProcessDefinition", notes = "IMPORT_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile"),
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String")
})
@PostMapping(value = "/import-definition")
@ApiException(IMPORT_PROCESS_DEFINE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = {"loginUser", "file"})
public Result importProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("file") MultipartFile file,
@RequestParam("projectName") String projectName) {
Map<String, Object> result = processDefinitionService.importProcessDefinition(loginUser, file, projectName);
return returnDataList(result);
}
/** /**
* query all project list * query all project list
* *
...@@ -292,7 +260,7 @@ public class ProjectController extends BaseController { ...@@ -292,7 +260,7 @@ public class ProjectController extends BaseController {
* @return all project list * @return all project list
*/ */
@ApiOperation(value = "queryAllProjectList", notes = "QUERY_ALL_PROJECT_LIST_NOTES") @ApiOperation(value = "queryAllProjectList", notes = "QUERY_ALL_PROJECT_LIST_NOTES")
@GetMapping(value = "/query-project-list") @GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR) @ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
......
...@@ -35,7 +35,9 @@ import java.util.Map; ...@@ -35,7 +35,9 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -53,7 +55,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -53,7 +55,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "QUEUE_TAG") @Api(tags = "QUEUE_TAG")
@RestController @RestController
@RequestMapping("/queue") @RequestMapping("/queues")
public class QueueController extends BaseController { public class QueueController extends BaseController {
@Autowired @Autowired
...@@ -91,7 +93,7 @@ public class QueueController extends BaseController { ...@@ -91,7 +93,7 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_QUEUE_LIST_ERROR) @ApiException(QUERY_QUEUE_LIST_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -122,7 +124,7 @@ public class QueueController extends BaseController { ...@@ -122,7 +124,7 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_QUEUE_ERROR) @ApiException(CREATE_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -148,12 +150,12 @@ public class QueueController extends BaseController { ...@@ -148,12 +150,12 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(UPDATE_QUEUE_ERROR) @ApiException(UPDATE_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateQueue(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id, @PathVariable(value = "id") int id,
@RequestParam(value = "queue") String queue, @RequestParam(value = "queue") String queue,
@RequestParam(value = "queueName") String queueName) { @RequestParam(value = "queueName") String queueName) {
Map<String, Object> result = queueService.updateQueue(loginUser, id, queue, queueName); Map<String, Object> result = queueService.updateQueue(loginUser, id, queue, queueName);
...@@ -173,7 +175,7 @@ public class QueueController extends BaseController { ...@@ -173,7 +175,7 @@ public class QueueController extends BaseController {
@ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "queue", value = "YARN_QUEUE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String") @ApiImplicitParam(name = "queueName", value = "QUEUE_NAME", required = true, dataType = "String")
}) })
@PostMapping(value = "/verify-queue") @PostMapping(value = "/verify")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_QUEUE_ERROR) @ApiException(VERIFY_QUEUE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
......
...@@ -64,8 +64,11 @@ import org.springframework.core.io.Resource; ...@@ -64,8 +64,11 @@ import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -96,7 +99,6 @@ public class ResourcesController extends BaseController { ...@@ -96,7 +99,6 @@ public class ResourcesController extends BaseController {
private UdfFuncService udfFuncService; private UdfFuncService udfFuncService;
/** /**
*
* @param loginUser login user * @param loginUser login user
* @param type type * @param type type
* @param alias alias * @param alias alias
...@@ -113,7 +115,7 @@ public class ResourcesController extends BaseController { ...@@ -113,7 +115,7 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String")
}) })
@PostMapping(value = "/directory/create") @PostMapping(value = "/directory")
@ApiException(CREATE_RESOURCE_ERROR) @ApiException(CREATE_RESOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createDirectory(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result createDirectory(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
...@@ -127,13 +129,7 @@ public class ResourcesController extends BaseController { ...@@ -127,13 +129,7 @@ public class ResourcesController extends BaseController {
/** /**
* create resource * create resource
* @param loginUser *
* @param type
* @param alias
* @param description
* @param file
* @param pid
* @param currentDir
* @return create result code * @return create result code
*/ */
@ApiOperation(value = "createResource", notes = "CREATE_RESOURCE_NOTES") @ApiOperation(value = "createResource", notes = "CREATE_RESOURCE_NOTES")
...@@ -145,7 +141,7 @@ public class ResourcesController extends BaseController { ...@@ -145,7 +141,7 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"), @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") @ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String")
}) })
@PostMapping(value = "/create") @PostMapping()
@ApiException(CREATE_RESOURCE_ERROR) @ApiException(CREATE_RESOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
...@@ -177,15 +173,15 @@ public class ResourcesController extends BaseController { ...@@ -177,15 +173,15 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"), @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"),
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile") @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ApiException(UPDATE_RESOURCE_ERROR) @ApiException(UPDATE_RESOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId, @PathVariable(value = "id") int resourceId,
@RequestParam(value = "type") ResourceType type, @RequestParam(value = "type") ResourceType type,
@RequestParam(value = "name") String alias, @RequestParam(value = "name") String alias,
@RequestParam(value = "description", required = false) String description, @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "file",required = false) MultipartFile file) { @RequestParam(value = "file", required = false) MultipartFile file) {
return resourceService.updateResource(loginUser, resourceId, alias, description, type, file); return resourceService.updateResource(loginUser, resourceId, alias, description, type, file);
} }
...@@ -229,7 +225,7 @@ public class ResourcesController extends BaseController { ...@@ -229,7 +225,7 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_RESOURCES_LIST_PAGING) @ApiException(QUERY_RESOURCES_LIST_PAGING)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -262,12 +258,12 @@ public class ResourcesController extends BaseController { ...@@ -262,12 +258,12 @@ public class ResourcesController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_RESOURCE_ERROR) @ApiException(DELETE_RESOURCE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId @PathVariable(value = "id") int resourceId
) throws Exception { ) throws Exception {
return resourceService.delete(loginUser, resourceId); return resourceService.delete(loginUser, resourceId);
} }
...@@ -298,7 +294,7 @@ public class ResourcesController extends BaseController { ...@@ -298,7 +294,7 @@ public class ResourcesController extends BaseController {
} }
/** /**
* query resources jar list * query resources by type
* *
* @param loginUser login user * @param loginUser login user
* @param type resource type * @param type resource type
...@@ -308,15 +304,15 @@ public class ResourcesController extends BaseController { ...@@ -308,15 +304,15 @@ public class ResourcesController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType") @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType")
}) })
@GetMapping(value = "/list/jar") @GetMapping(value = "/query-by-type")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_RESOURCES_LIST_ERROR) @ApiException(QUERY_RESOURCES_LIST_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type, @RequestParam(value = "type") ResourceType type,
@RequestParam(value = "programType",required = false) ProgramType programType @RequestParam(value = "programType", required = false) ProgramType programType
) { ) {
Map<String, Object> result = resourceService.queryResourceByProgramType(loginUser, type,programType); Map<String, Object> result = resourceService.queryResourceByProgramType(loginUser, type, programType);
return returnDataList(result); return returnDataList(result);
} }
...@@ -335,13 +331,13 @@ public class ResourcesController extends BaseController { ...@@ -335,13 +331,13 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = false, dataType = "Int", example = "10") @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = false, dataType = "Int", example = "10")
}) })
@GetMapping(value = "/queryResource") @GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(RESOURCE_NOT_EXIST) @ApiException(RESOURCE_NOT_EXIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "fullName", required = false) String fullName, @RequestParam(value = "fullName", required = false) String fullName,
@RequestParam(value = "id", required = false) Integer id, @PathVariable(value = "id", required = false) Integer id,
@RequestParam(value = "type") ResourceType type @RequestParam(value = "type") ResourceType type
) { ) {
...@@ -363,11 +359,11 @@ public class ResourcesController extends BaseController { ...@@ -363,11 +359,11 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/view") @GetMapping(value = "/{id}/view")
@ApiException(VIEW_RESOURCE_FILE_ON_LINE_ERROR) @ApiException(VIEW_RESOURCE_FILE_ON_LINE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId, @PathVariable(value = "id") int resourceId,
@RequestParam(value = "skipLineNum") int skipLineNum, @RequestParam(value = "skipLineNum") int skipLineNum,
@RequestParam(value = "limit") int limit @RequestParam(value = "limit") int limit
) { ) {
...@@ -376,14 +372,7 @@ public class ResourcesController extends BaseController { ...@@ -376,14 +372,7 @@ public class ResourcesController extends BaseController {
/** /**
* create resource file online * create resource file online
* @param loginUser *
* @param type
* @param fileName
* @param fileSuffix
* @param description
* @param content
* @param pid
* @param currentDir
* @return create result code * @return create result code
*/ */
@ApiOperation(value = "onlineCreateResource", notes = "ONLINE_CREATE_RESOURCE_NOTES") @ApiOperation(value = "onlineCreateResource", notes = "ONLINE_CREATE_RESOURCE_NOTES")
...@@ -428,11 +417,11 @@ public class ResourcesController extends BaseController { ...@@ -428,11 +417,11 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String") @ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String")
}) })
@PostMapping(value = "/update-content") @PutMapping(value = "/{id}/update-content")
@ApiException(EDIT_RESOURCE_FILE_ON_LINE_ERROR) @ApiException(EDIT_RESOURCE_FILE_ON_LINE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId, @PathVariable(value = "id") int resourceId,
@RequestParam(value = "content") String content @RequestParam(value = "content") String content
) { ) {
if (StringUtils.isEmpty(content)) { if (StringUtils.isEmpty(content)) {
...@@ -453,12 +442,12 @@ public class ResourcesController extends BaseController { ...@@ -453,12 +442,12 @@ public class ResourcesController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/download") @GetMapping(value = "/{id}/download")
@ResponseBody @ResponseBody
@ApiException(DOWNLOAD_RESOURCE_FILE_ERROR) @ApiException(DOWNLOAD_RESOURCE_FILE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId) throws Exception { @PathVariable(value = "id") int resourceId) throws Exception {
Resource file = resourceService.downloadResource(resourceId); Resource file = resourceService.downloadResource(resourceId);
if (file == null) { if (file == null) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Status.RESOURCE_NOT_EXIST.getMsg()); return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Status.RESOURCE_NOT_EXIST.getMsg());
...@@ -494,7 +483,7 @@ public class ResourcesController extends BaseController { ...@@ -494,7 +483,7 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/udf-func/create") @PostMapping(value = "/{resourceId}/udf-func")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_UDF_FUNCTION_ERROR) @ApiException(CREATE_UDF_FUNCTION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -505,7 +494,7 @@ public class ResourcesController extends BaseController { ...@@ -505,7 +494,7 @@ public class ResourcesController extends BaseController {
@RequestParam(value = "argTypes", required = false) String argTypes, @RequestParam(value = "argTypes", required = false) String argTypes,
@RequestParam(value = "database", required = false) String database, @RequestParam(value = "database", required = false) String database,
@RequestParam(value = "description", required = false) String description, @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "resourceId") int resourceId) { @PathVariable(value = "resourceId") int resourceId) {
return udfFuncService.createUdfFunction(loginUser, funcName, className, argTypes, database, description, type, resourceId); return udfFuncService.createUdfFunction(loginUser, funcName, className, argTypes, database, description, type, resourceId);
} }
...@@ -521,12 +510,12 @@ public class ResourcesController extends BaseController { ...@@ -521,12 +510,12 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/udf-func/update-ui") @GetMapping(value = "/{id}/udf-func")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(VIEW_UDF_FUNCTION_ERROR) @ApiException(VIEW_UDF_FUNCTION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) { @PathVariable("id") int id) {
Map<String, Object> map = udfFuncService.queryUdfFuncDetail(id); Map<String, Object> map = udfFuncService.queryUdfFuncDetail(id);
return returnDataList(map); return returnDataList(map);
} }
...@@ -557,18 +546,18 @@ public class ResourcesController extends BaseController { ...@@ -557,18 +546,18 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/udf-func/update") @PutMapping(value = "/{resourceId}/udf-func/{id}")
@ApiException(UPDATE_UDF_FUNCTION_ERROR) @ApiException(UPDATE_UDF_FUNCTION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int udfFuncId, @PathVariable(value = "id") int udfFuncId,
@RequestParam(value = "type") UdfType type, @RequestParam(value = "type") UdfType type,
@RequestParam(value = "funcName") String funcName, @RequestParam(value = "funcName") String funcName,
@RequestParam(value = "className") String className, @RequestParam(value = "className") String className,
@RequestParam(value = "argTypes", required = false) String argTypes, @RequestParam(value = "argTypes", required = false) String argTypes,
@RequestParam(value = "database", required = false) String database, @RequestParam(value = "database", required = false) String database,
@RequestParam(value = "description", required = false) String description, @RequestParam(value = "description", required = false) String description,
@RequestParam(value = "resourceId") int resourceId) { @PathVariable(value = "resourceId") int resourceId) {
Map<String, Object> result = udfFuncService.updateUdfFunc(udfFuncId, funcName, className, argTypes, database, description, type, resourceId); Map<String, Object> result = udfFuncService.updateUdfFunc(udfFuncId, funcName, className, argTypes, database, description, type, resourceId);
return returnDataList(result); return returnDataList(result);
} }
...@@ -588,7 +577,7 @@ public class ResourcesController extends BaseController { ...@@ -588,7 +577,7 @@ public class ResourcesController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/udf-func/list-paging") @GetMapping(value = "/udf-func")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR) @ApiException(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -659,14 +648,14 @@ public class ResourcesController extends BaseController { ...@@ -659,14 +648,14 @@ public class ResourcesController extends BaseController {
*/ */
@ApiOperation(value = "deleteUdfFunc", notes = "DELETE_UDF_FUNCTION_NOTES") @ApiOperation(value = "deleteUdfFunc", notes = "DELETE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "UDF_FUNC_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/udf-func/delete") @DeleteMapping(value = "/udf-func/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_UDF_FUNCTION_ERROR) @ApiException(DELETE_UDF_FUNCTION_ERROR)
@AccessLogAnnotation @AccessLogAnnotation
public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int udfFuncId @PathVariable(value = "id") int udfFuncId
) { ) {
return udfFuncService.delete(udfFuncId); return udfFuncService.delete(udfFuncId);
} }
...@@ -704,7 +693,7 @@ public class ResourcesController extends BaseController { ...@@ -704,7 +693,7 @@ public class ResourcesController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
}) })
@GetMapping(value = "/authorize-resource-tree") @GetMapping(value = "/authed-resource-tree")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(AUTHORIZE_RESOURCE_TREE) @ApiException(AUTHORIZE_RESOURCE_TREE)
@AccessLogAnnotation @AccessLogAnnotation
......
...@@ -42,9 +42,11 @@ import java.util.Map; ...@@ -42,9 +42,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -63,7 +65,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -63,7 +65,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "SCHEDULER_TAG") @Api(tags = "SCHEDULER_TAG")
@RestController @RestController
@RequestMapping("/projects/{projectName}/schedule") @RequestMapping("/projects/{projectCode}/schedules")
public class SchedulerController extends BaseController { public class SchedulerController extends BaseController {
public static final String DEFAULT_WARNING_TYPE = "NONE"; public static final String DEFAULT_WARNING_TYPE = "NONE";
...@@ -78,8 +80,8 @@ public class SchedulerController extends BaseController { ...@@ -78,8 +80,8 @@ public class SchedulerController extends BaseController {
* create schedule * create schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionId process definition id * @param processDefinitionCode process definition code
* @param schedule scheduler * @param schedule scheduler
* @param warningType warning type * @param warningType warning type
* @param warningGroupId warning group id * @param warningGroupId warning group id
...@@ -90,24 +92,23 @@ public class SchedulerController extends BaseController { ...@@ -90,24 +92,23 @@ public class SchedulerController extends BaseController {
*/ */
@ApiOperation(value = "createSchedule", notes = "CREATE_SCHEDULE_NOTES") @ApiOperation(value = "createSchedule", notes = "CREATE_SCHEDULE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataType = "Long", example = "100"),
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", required = true, dataType = "String", @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String",
example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','timezoneId':'America/Phoenix','crontab':'0 0 3/6 * * ? *'}"), example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','timezoneId':'America/Phoenix','crontab':'0 0 3/6 * * ? *'}"),
@ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"), @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"), @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"),
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "workerGroup", value = "WORKER_GROUP", dataType = "String"),
@ApiImplicitParam(name = "environmentCode", value = "ENVIRONMENT_CODE", dataType = "Long"), @ApiImplicitParam(name = "environmentCode", value = "ENVIRONMENT_CODE", dataType = "Long"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"), @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"),
}) })
@PostMapping("/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_SCHEDULE_ERROR) @ApiException(CREATE_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result createSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "processDefinitionId") Integer processDefinitionId, @RequestParam(value = "processDefinitionCode") long processDefinitionCode,
@RequestParam(value = "schedule") String schedule, @RequestParam(value = "schedule") String schedule,
@RequestParam(value = "warningType", required = false, defaultValue = DEFAULT_WARNING_TYPE) WarningType warningType, @RequestParam(value = "warningType", required = false, defaultValue = DEFAULT_WARNING_TYPE) WarningType warningType,
@RequestParam(value = "warningGroupId", required = false, defaultValue = DEFAULT_NOTIFY_GROUP_ID) int warningGroupId, @RequestParam(value = "warningGroupId", required = false, defaultValue = DEFAULT_NOTIFY_GROUP_ID) int warningGroupId,
...@@ -115,7 +116,7 @@ public class SchedulerController extends BaseController { ...@@ -115,7 +116,7 @@ public class SchedulerController extends BaseController {
@RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup, @RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup,
@RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode, @RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode,
@RequestParam(value = "processInstancePriority", required = false, defaultValue = DEFAULT_PROCESS_INSTANCE_PRIORITY) Priority processInstancePriority) { @RequestParam(value = "processInstancePriority", required = false, defaultValue = DEFAULT_PROCESS_INSTANCE_PRIORITY) Priority processInstancePriority) {
Map<String, Object> result = schedulerService.insertSchedule(loginUser, projectName, processDefinitionId, schedule, Map<String, Object> result = schedulerService.insertSchedule(loginUser, projectCode, processDefinitionCode, schedule,
warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode); warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode);
return returnDataList(result); return returnDataList(result);
...@@ -125,7 +126,7 @@ public class SchedulerController extends BaseController { ...@@ -125,7 +126,7 @@ public class SchedulerController extends BaseController {
* updateProcessInstance schedule * updateProcessInstance schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param id scheduler id * @param id scheduler id
* @param schedule scheduler * @param schedule scheduler
* @param warningType warning type * @param warningType warning type
...@@ -138,23 +139,20 @@ public class SchedulerController extends BaseController { ...@@ -138,23 +139,20 @@ public class SchedulerController extends BaseController {
@ApiOperation(value = "updateSchedule", notes = "UPDATE_SCHEDULE_NOTES") @ApiOperation(value = "updateSchedule", notes = "UPDATE_SCHEDULE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", required = true, dataType = "String", @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"),
example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00',"
+ "'crontab':'0 0 3/6 * * ? *'}"),
@ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"), @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", type = "WarningType"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"), @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", type = "FailureStrategy"),
@ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"), @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int", example = "100"),
@ApiImplicitParam(name = "workerGroup", value = "WORKER_GROUP", dataType = "String"), @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority"),
@ApiImplicitParam(name = "environmentCode", value = "ENVIRONMENT_CODE", dataType = "Long"), @ApiImplicitParam(name = "environmentCode", value = "ENVIRONMENT_CODE", dataType = "Long"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", type = "Priority")
}) })
@PostMapping("/update") @PutMapping("/{id}")
@ApiException(UPDATE_SCHEDULE_ERROR) @ApiException(UPDATE_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result updateSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "id") Integer id, @PathVariable(value = "id") Integer id,
@RequestParam(value = "schedule") String schedule, @RequestParam(value = "schedule") String schedule,
@RequestParam(value = "warningType", required = false, defaultValue = DEFAULT_WARNING_TYPE) WarningType warningType, @RequestParam(value = "warningType", required = false, defaultValue = DEFAULT_WARNING_TYPE) WarningType warningType,
@RequestParam(value = "warningGroupId", required = false) int warningGroupId, @RequestParam(value = "warningGroupId", required = false) int warningGroupId,
...@@ -163,8 +161,8 @@ public class SchedulerController extends BaseController { ...@@ -163,8 +161,8 @@ public class SchedulerController extends BaseController {
@RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode, @RequestParam(value = "environmentCode", required = false, defaultValue = "-1") Long environmentCode,
@RequestParam(value = "processInstancePriority", required = false) Priority processInstancePriority) { @RequestParam(value = "processInstancePriority", required = false) Priority processInstancePriority) {
Map<String, Object> result = schedulerService.updateSchedule(loginUser, projectName, id, schedule, Map<String, Object> result = schedulerService.updateSchedule(loginUser, projectCode, id, schedule,
warningType, warningGroupId, failureStrategy, null, processInstancePriority, workerGroup, environmentCode); warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode);
return returnDataList(result); return returnDataList(result);
} }
...@@ -172,7 +170,7 @@ public class SchedulerController extends BaseController { ...@@ -172,7 +170,7 @@ public class SchedulerController extends BaseController {
* publish schedule setScheduleState * publish schedule setScheduleState
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param id scheduler id * @param id scheduler id
* @return publish result code * @return publish result code
*/ */
...@@ -180,13 +178,13 @@ public class SchedulerController extends BaseController { ...@@ -180,13 +178,13 @@ public class SchedulerController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping("/online") @PostMapping("/{id}/online")
@ApiException(PUBLISH_SCHEDULE_ONLINE_ERROR) @ApiException(PUBLISH_SCHEDULE_ONLINE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result online(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result online(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("id") Integer id) { @PathVariable("id") Integer id) {
Map<String, Object> result = schedulerService.setScheduleState(loginUser, projectName, id, ReleaseState.ONLINE); Map<String, Object> result = schedulerService.setScheduleState(loginUser, projectCode, id, ReleaseState.ONLINE);
return returnDataList(result); return returnDataList(result);
} }
...@@ -194,7 +192,7 @@ public class SchedulerController extends BaseController { ...@@ -194,7 +192,7 @@ public class SchedulerController extends BaseController {
* offline schedule * offline schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param id schedule id * @param id schedule id
* @return operation result code * @return operation result code
*/ */
...@@ -202,14 +200,14 @@ public class SchedulerController extends BaseController { ...@@ -202,14 +200,14 @@ public class SchedulerController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping("/offline") @PostMapping("/{id}/offline")
@ApiException(OFFLINE_SCHEDULE_ERROR) @ApiException(OFFLINE_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result offline(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result offline(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("id") Integer id) { @PathVariable("id") Integer id) {
Map<String, Object> result = schedulerService.setScheduleState(loginUser, projectName, id, ReleaseState.OFFLINE); Map<String, Object> result = schedulerService.setScheduleState(loginUser, projectCode, id, ReleaseState.OFFLINE);
return returnDataList(result); return returnDataList(result);
} }
...@@ -217,8 +215,8 @@ public class SchedulerController extends BaseController { ...@@ -217,8 +215,8 @@ public class SchedulerController extends BaseController {
* query schedule list paging * query schedule list paging
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionId process definition id * @param processDefinitionCode process definition code
* @param pageNo page number * @param pageNo page number
* @param pageSize page size * @param pageSize page size
* @param searchVal search value * @param searchVal search value
...@@ -228,16 +226,15 @@ public class SchedulerController extends BaseController { ...@@ -228,16 +226,15 @@ public class SchedulerController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"), @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", type = "String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "20")
}) })
@GetMapping("/list-paging") @GetMapping()
@ApiException(QUERY_SCHEDULE_LIST_PAGING_ERROR) @ApiException(QUERY_SCHEDULE_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryScheduleListPaging(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result queryScheduleListPaging(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam Integer processDefinitionId, @RequestParam long processDefinitionCode,
@RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageNo") Integer pageNo, @RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) { @RequestParam("pageSize") Integer pageSize) {
...@@ -246,32 +243,31 @@ public class SchedulerController extends BaseController { ...@@ -246,32 +243,31 @@ public class SchedulerController extends BaseController {
return result; return result;
} }
searchVal = ParameterUtils.handleEscapes(searchVal); searchVal = ParameterUtils.handleEscapes(searchVal);
result = schedulerService.querySchedule(loginUser, projectName, processDefinitionId, searchVal, pageNo, pageSize); result = schedulerService.querySchedule(loginUser, projectCode, processDefinitionCode, searchVal, pageNo, pageSize);
return result; return result;
} }
/** /**
* delete schedule by id * delete schedule by id
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param scheduleId schedule id * @param id scheule id
* @return delete result code * @return delete result code
*/ */
@ApiOperation(value = "deleteScheduleById", notes = "OFFLINE_SCHEDULE_NOTES") @ApiOperation(value = "deleteScheduleById", notes = "OFFLINE_SCHEDULE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "scheduleId", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "id", value = "SCHEDULE_ID", required = true, dataType = "Int", example = "100")
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", required = true, dataType = "String"),
}) })
@GetMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_SCHEDULE_CRON_BY_ID_ERROR) @ApiException(DELETE_SCHEDULE_CRON_BY_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteScheduleById(@RequestAttribute(value = SESSION_USER) User loginUser, public Result deleteScheduleById(@RequestAttribute(value = SESSION_USER) User loginUser,
@PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("scheduleId") Integer scheduleId @PathVariable("id") Integer id) {
) { Map<String, Object> result = schedulerService.deleteScheduleById(loginUser, projectCode, id);
Map<String, Object> result = schedulerService.deleteScheduleById(loginUser, projectName, scheduleId);
return returnDataList(result); return returnDataList(result);
} }
...@@ -279,7 +275,7 @@ public class SchedulerController extends BaseController { ...@@ -279,7 +275,7 @@ public class SchedulerController extends BaseController {
* query schedule list * query schedule list
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @return schedule list * @return schedule list
*/ */
@ApiOperation(value = "queryScheduleList", notes = "QUERY_SCHEDULE_LIST_NOTES") @ApiOperation(value = "queryScheduleList", notes = "QUERY_SCHEDULE_LIST_NOTES")
...@@ -287,8 +283,8 @@ public class SchedulerController extends BaseController { ...@@ -287,8 +283,8 @@ public class SchedulerController extends BaseController {
@ApiException(QUERY_SCHEDULE_LIST_ERROR) @ApiException(QUERY_SCHEDULE_LIST_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryScheduleList(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result queryScheduleList(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName) { @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result = schedulerService.queryScheduleList(loginUser, projectName); Map<String, Object> result = schedulerService.queryScheduleList(loginUser, projectCode);
return returnDataList(result); return returnDataList(result);
} }
...@@ -296,25 +292,20 @@ public class SchedulerController extends BaseController { ...@@ -296,25 +292,20 @@ public class SchedulerController extends BaseController {
* preview schedule * preview schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name
* @param schedule schedule expression * @param schedule schedule expression
* @return the next five fire time * @return the next five fire time
*/ */
@ApiOperation(value = "previewSchedule", notes = "PREVIEW_SCHEDULE_NOTES") @ApiOperation(value = "previewSchedule", notes = "PREVIEW_SCHEDULE_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "schedule", value = "SCHEDULE", required = true, dataType = "String", @ApiImplicitParam(name = "schedule", value = "SCHEDULE", dataType = "String", example = "{'startTime':'2019-06-10 00:00:00','endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"),
example = "{'startTime':'2019-06-10 00:00:00',"
+ "'endTime':'2019-06-13 00:00:00','crontab':'0 0 3/6 * * ? *'}"),
}) })
@PostMapping("/preview") @PostMapping("/preview")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(PREVIEW_SCHEDULE_ERROR) @ApiException(PREVIEW_SCHEDULE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result previewSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result previewSchedule(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @RequestParam(value = "schedule") String schedule) {
@RequestParam(value = "schedule") String schedule Map<String, Object> result = schedulerService.previewSchedule(loginUser, schedule);
) {
Map<String, Object> result = schedulerService.previewSchedule(loginUser, projectName, schedule);
return returnDataList(result); return returnDataList(result);
} }
} }
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_TASK_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_TASK_DEFINE_BY_CODE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_TASK_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_DETAIL_OF_TASK_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TASK_DEFINITION_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_TASK_DEFINITION_VERSIONS_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.SWITCH_TASK_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_TASK_DEFINITION_ERROR;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import springfox.documentation.annotations.ApiIgnore;
/**
* task definition controller
*/
@Api(tags = "TASK_DEFINITION_TAG")
@RestController
@RequestMapping("projects/{projectCode}/task-definition")
public class TaskDefinitionController extends BaseController {
@Autowired
private TaskDefinitionService taskDefinitionService;
/**
* create task definition
*
* @param loginUser login user
* @param projectCode project code
* @param taskDefinitionJson task definition json
* @return create result code
*/
@ApiOperation(value = "save", notes = "CREATE_TASK_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, type = "Long"),
@ApiImplicitParam(name = "taskDefinitionJson", value = "TASK_DEFINITION_JSON", required = true, type = "String")
})
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_TASK_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createTaskDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "taskDefinitionJson", required = true) String taskDefinitionJson) {
Map<String, Object> result = taskDefinitionService.createTaskDefinition(loginUser, projectCode, taskDefinitionJson);
return returnDataList(result);
}
/**
* update task definition
*
* @param loginUser login user
* @param projectCode project code
* @param code task definition code
* @param taskDefinitionJsonObj task definition json object
* @return update result code
*/
@ApiOperation(value = "update", notes = "UPDATE_TASK_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, type = "Long"),
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "taskDefinitionJsonObj", value = "TASK_DEFINITION_JSON", required = true, type = "String")
})
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_TASK_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateTaskDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@RequestParam(value = "taskDefinitionJsonObj", required = true) String taskDefinitionJsonObj) {
Map<String, Object> result = taskDefinitionService.updateTaskDefinition(loginUser, projectCode, code, taskDefinitionJsonObj);
return returnDataList(result);
}
/**
* query task definition version paging list info
*
* @param loginUser login user info
* @param projectCode project code
* @param code task definition code
* @param pageNo the task definition version list current page number
* @param pageSize the task definition version list page size
* @param code the task definition code
* @return the task definition version list
*/
@ApiOperation(value = "queryVersions", notes = "QUERY_TASK_DEFINITION_VERSIONS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10")
})
@GetMapping(value = "/{code}/versions")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_DEFINITION_VERSIONS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskDefinitionVersions(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
return taskDefinitionService.queryTaskDefinitionVersions(loginUser, projectCode, code, pageNo, pageSize);
}
/**
* switch task definition version
*
* @param loginUser login user info
* @param projectCode project code
* @param code the task definition code
* @param version the version user want to switch
* @return switch version result code
*/
@ApiOperation(value = "switchVersion", notes = "SWITCH_TASK_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(SWITCH_TASK_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result switchTaskDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = taskDefinitionService.switchVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
/**
* delete the certain task definition version by version and code
*
* @param loginUser login user info
* @param projectCode project code
* @param code the task definition code
* @param version the task definition version user want to delete
* @return delete version result code
*/
@ApiOperation(value = "deleteVersion", notes = "DELETE_TASK_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataType = "Int", example = "100")
})
@DeleteMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_TASK_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteTaskDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result = taskDefinitionService.deleteByCodeAndVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
/**
* delete task definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code the task definition code
* @return delete result code
*/
@ApiOperation(value = "deleteTaskDefinition", notes = "DELETE_TASK_DEFINITION_BY_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_TASK_DEFINE_BY_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteTaskDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code) {
Map<String, Object> result = taskDefinitionService.deleteTaskDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
/**
* query detail of task definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code the task definition code
* @return task definition detail
*/
@ApiOperation(value = "queryTaskDefinitionByCode", notes = "QUERY_TASK_DEFINITION_DETAIL_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "TASK_DEFINITION_CODE", required = true, dataType = "Long", example = "1")
})
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DETAIL_OF_TASK_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskDefinitionDetail(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code) {
Map<String, Object> result = taskDefinitionService.queryTaskDefinitionDetail(loginUser, projectCode, code);
return returnDataList(result);
}
/**
* query task definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param taskType taskType
* @param searchVal search value
* @param userId user id
* @param pageNo page number
* @param pageSize page size
* @return task definition page
*/
@ApiOperation(value = "queryTaskDefinitionListPaging", notes = "QUERY_TASK_DEFINITION_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "taskType", value = "TASK_TYPE", required = false, type = "String"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, type = "String"),
@ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10")
})
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_DEFINITION_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskDefinitionListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "taskType", required = false) String taskType,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam(value = "userId", required = false, defaultValue = "0") Integer userId,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
taskType = ParameterUtils.handleEscapes(taskType);
searchVal = ParameterUtils.handleEscapes(searchVal);
return taskDefinitionService.queryTaskDefinitionListPaging(loginUser, projectCode, taskType, searchVal, userId, pageNo, pageSize);
}
/**
* gen task code list
*
* @param loginUser login user
* @param genNum gen num
* @return task code list
*/
@ApiOperation(value = "genTaskCodeList", notes = "GEN_TASK_CODE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "genNum", value = "GEN_NUM", required = true, dataType = "Int", example = "1")
})
@GetMapping(value = "/gen-task-codes")
@ResponseStatus(HttpStatus.OK)
@ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result genTaskCodeList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("genNum") Integer genNum) {
Map<String, Object> result = taskDefinitionService.genTaskCodeList(loginUser, genNum);
return returnDataList(result);
}
}
...@@ -54,10 +54,9 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -54,10 +54,9 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "TASK_INSTANCE_TAG") @Api(tags = "TASK_INSTANCE_TAG")
@RestController @RestController
@RequestMapping("/projects/{projectName}/task-instance") @RequestMapping("/projects/{projectCode}/task-instances")
public class TaskInstanceController extends BaseController { public class TaskInstanceController extends BaseController {
@Autowired @Autowired
TaskInstanceService taskInstanceService; TaskInstanceService taskInstanceService;
...@@ -65,7 +64,7 @@ public class TaskInstanceController extends BaseController { ...@@ -65,7 +64,7 @@ public class TaskInstanceController extends BaseController {
* query task list paging * query task list paging
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processInstanceId process instance id * @param processInstanceId process instance id
* @param searchVal search value * @param searchVal search value
* @param taskName task name * @param taskName task name
...@@ -91,12 +90,12 @@ public class TaskInstanceController extends BaseController { ...@@ -91,12 +90,12 @@ public class TaskInstanceController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping("/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TASK_LIST_PAGING_ERROR) @ApiException(QUERY_TASK_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryTaskListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryTaskListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "processInstanceId", required = false, defaultValue = "0") Integer processInstanceId, @RequestParam(value = "processInstanceId", required = false, defaultValue = "0") Integer processInstanceId,
@RequestParam(value = "processInstanceName", required = false) String processInstanceName, @RequestParam(value = "processInstanceName", required = false) String processInstanceName,
@RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam(value = "searchVal", required = false) String searchVal,
...@@ -113,8 +112,8 @@ public class TaskInstanceController extends BaseController { ...@@ -113,8 +112,8 @@ public class TaskInstanceController extends BaseController {
return result; return result;
} }
searchVal = ParameterUtils.handleEscapes(searchVal); searchVal = ParameterUtils.handleEscapes(searchVal);
result = taskInstanceService.queryTaskListPaging( result = taskInstanceService.queryTaskListPaging(loginUser, projectCode, processInstanceId, processInstanceName,
loginUser, projectName, processInstanceId, processInstanceName, taskName, executorName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize); taskName, executorName, startTime, endTime, searchVal, stateType, host, pageNo, pageSize);
return result; return result;
} }
...@@ -122,22 +121,22 @@ public class TaskInstanceController extends BaseController { ...@@ -122,22 +121,22 @@ public class TaskInstanceController extends BaseController {
* change one task instance's state from FAILURE to FORCED_SUCCESS * change one task instance's state from FAILURE to FORCED_SUCCESS
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param taskInstanceId task instance id * @param id task instance id
* @return the result code and msg * @return the result code and msg
*/ */
@ApiOperation(value = "force-success", notes = "FORCE_TASK_SUCCESS") @ApiOperation(value = "force-success", notes = "FORCE_TASK_SUCCESS")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "taskInstanceId", value = "TASK_INSTANCE_ID", required = true, dataType = "Int", example = "12") @ApiImplicitParam(name = "id", value = "TASK_INSTANCE_ID", required = true, dataType = "Int", example = "12")
}) })
@PostMapping(value = "/force-success") @PostMapping(value = "/{id}/force-success")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(FORCE_TASK_SUCCESS_ERROR) @ApiException(FORCE_TASK_SUCCESS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<Object> forceTaskSuccess(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result<Object> forceTaskSuccess(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "taskInstanceId") Integer taskInstanceId) { @PathVariable(value = "id") Integer id) {
Map<String, Object> result = taskInstanceService.forceTaskSuccess(loginUser, projectName, taskInstanceId); Map<String, Object> result = taskInstanceService.forceTaskSuccess(loginUser, projectCode, id);
return returnDataList(result); return returnDataList(result);
} }
......
...@@ -36,8 +36,11 @@ import java.util.Map; ...@@ -36,8 +36,11 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
...@@ -55,7 +58,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -55,7 +58,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "TENANT_TAG") @Api(tags = "TENANT_TAG")
@RestController @RestController
@RequestMapping("/tenant") @RequestMapping("/tenants")
public class TenantController extends BaseController { public class TenantController extends BaseController {
@Autowired @Autowired
...@@ -75,9 +78,8 @@ public class TenantController extends BaseController { ...@@ -75,9 +78,8 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"), @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "description", value = "TENANT_DESC", dataType = "String") @ApiImplicitParam(name = "description", value = "TENANT_DESC", dataType = "String")
}) })
@PostMapping(value = "/create") @PostMapping()
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_TENANT_ERROR) @ApiException(CREATE_TENANT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -105,7 +107,7 @@ public class TenantController extends BaseController { ...@@ -105,7 +107,7 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20") @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_TENANT_LIST_PAGING_ERROR) @ApiException(QUERY_TENANT_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -157,14 +159,13 @@ public class TenantController extends BaseController { ...@@ -157,14 +159,13 @@ public class TenantController extends BaseController {
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"), @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String"),
@ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "queueId", value = "QUEUE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "description", value = "TENANT_DESC", type = "String") @ApiImplicitParam(name = "description", value = "TENANT_DESC", type = "String")
}) })
@PostMapping(value = "/update") @PutMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_TENANT_ERROR) @ApiException(UPDATE_TENANT_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateTenant(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result updateTenant(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id, @PathVariable(value = "id") int id,
@RequestParam(value = "tenantCode") String tenantCode, @RequestParam(value = "tenantCode") String tenantCode,
@RequestParam(value = "queueId") int queueId, @RequestParam(value = "queueId") int queueId,
@RequestParam(value = "description", required = false) String description) throws Exception { @RequestParam(value = "description", required = false) String description) throws Exception {
...@@ -183,14 +184,13 @@ public class TenantController extends BaseController { ...@@ -183,14 +184,13 @@ public class TenantController extends BaseController {
@ApiOperation(value = "deleteTenantById", notes = "DELETE_TENANT_NOTES") @ApiOperation(value = "deleteTenantById", notes = "DELETE_TENANT_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100") @ApiImplicitParam(name = "id", value = "TENANT_ID", required = true, dataType = "Int", example = "100")
}) })
@PostMapping(value = "/delete") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_TENANT_BY_ID_ERROR) @ApiException(DELETE_TENANT_BY_ID_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteTenantById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteTenantById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int id) throws Exception { @PathVariable(value = "id") int id) throws Exception {
Map<String, Object> result = tenantService.deleteTenantById(loginUser, id); Map<String, Object> result = tenantService.deleteTenantById(loginUser, id);
return returnDataList(result); return returnDataList(result);
} }
...@@ -206,7 +206,7 @@ public class TenantController extends BaseController { ...@@ -206,7 +206,7 @@ public class TenantController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String") @ApiImplicitParam(name = "tenantCode", value = "TENANT_CODE", required = true, dataType = "String")
}) })
@GetMapping(value = "/verify-tenant-code") @GetMapping(value = "/verify-code")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_OS_TENANT_CODE_ERROR) @ApiException(VERIFY_OS_TENANT_CODE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
......
...@@ -31,6 +31,8 @@ import java.util.Map; ...@@ -31,6 +31,8 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -62,7 +64,7 @@ public class UiPluginController extends BaseController { ...@@ -62,7 +64,7 @@ public class UiPluginController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "pluginType", value = "pluginType", required = true, dataType = "PluginType"), @ApiImplicitParam(name = "pluginType", value = "pluginType", required = true, dataType = "PluginType"),
}) })
@PostMapping(value = "/queryUiPluginsByType") @GetMapping(value = "/query-by-type")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(QUERY_PLUGINS_ERROR) @ApiException(QUERY_PLUGINS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -75,14 +77,14 @@ public class UiPluginController extends BaseController { ...@@ -75,14 +77,14 @@ public class UiPluginController extends BaseController {
@ApiOperation(value = "queryUiPluginDetailById", notes = "QUERY_UI_PLUGIN_DETAIL_BY_ID") @ApiOperation(value = "queryUiPluginDetailById", notes = "QUERY_UI_PLUGIN_DETAIL_BY_ID")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "pluginId", value = "PLUGIN_ID", required = true, dataType = "Int", example = "100"), @ApiImplicitParam(name = "id", value = "PLUGIN_ID", required = true, dataType = "Int", example = "100"),
}) })
@PostMapping(value = "/queryUiPluginDetailById") @GetMapping(value = "/{id}")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
@ApiException(QUERY_PLUGINS_ERROR) @ApiException(QUERY_PLUGINS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryUiPluginDetailById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result queryUiPluginDetailById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pluginId") Integer pluginId) { @PathVariable("id") Integer pluginId) {
Map<String, Object> result = uiPluginService.queryUiPluginDetailById(pluginId); Map<String, Object> result = uiPluginService.queryUiPluginDetailById(pluginId);
return returnDataList(result); return returnDataList(result);
......
...@@ -119,7 +119,7 @@ public class UsersController extends BaseController { ...@@ -119,7 +119,7 @@ public class UsersController extends BaseController {
* *
* @param loginUser login user * @param loginUser login user
* @param pageNo page number * @param pageNo page number
* @param searchVal search value * @param searchVal search avlue
* @param pageSize page size * @param pageSize page size
* @return user list page * @return user list page
*/ */
...@@ -156,7 +156,7 @@ public class UsersController extends BaseController { ...@@ -156,7 +156,7 @@ public class UsersController extends BaseController {
* @param userName user name * @param userName user name
* @param userPassword user password * @param userPassword user password
* @param email email * @param email email
* @param tenantId tenant id * @param tenantId tennat id
* @param phone phone * @param phone phone
* @param queue queue * @param queue queue
* @return update result code * @return update result code
...@@ -436,7 +436,7 @@ public class UsersController extends BaseController { ...@@ -436,7 +436,7 @@ public class UsersController extends BaseController {
* @param repeatPassword repeat password * @param repeatPassword repeat password
* @param email user email * @param email user email
*/ */
@ApiOperation(value = "registerUser",notes = "REGISTER_USER_NOTES") @ApiOperation(value = "registerUser", notes = "REGISTER_USER_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"), @ApiImplicitParam(name = "userName", value = "USER_NAME", required = true, type = "String"),
@ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"), @ApiImplicitParam(name = "userPassword", value = "USER_PASSWORD", required = true, type = "String"),
...@@ -464,7 +464,7 @@ public class UsersController extends BaseController { ...@@ -464,7 +464,7 @@ public class UsersController extends BaseController {
* *
* @param userName user name * @param userName user name
*/ */
@ApiOperation(value = "activateUser",notes = "ACTIVATE_USER_NOTES") @ApiOperation(value = "activateUser", notes = "ACTIVATE_USER_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userName", value = "USER_NAME", type = "String"), @ApiImplicitParam(name = "userName", value = "USER_NAME", type = "String"),
}) })
...@@ -484,7 +484,7 @@ public class UsersController extends BaseController { ...@@ -484,7 +484,7 @@ public class UsersController extends BaseController {
* *
* @param userNames user names * @param userNames user names
*/ */
@ApiOperation(value = "batchActivateUser",notes = "BATCH_ACTIVATE_USER_NOTES") @ApiOperation(value = "batchActivateUser", notes = "BATCH_ACTIVATE_USER_NOTES")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userNames", value = "USER_NAMES", required = true, type = "String"), @ApiImplicitParam(name = "userNames", value = "USER_NAMES", required = true, type = "String"),
}) })
......
...@@ -54,7 +54,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -54,7 +54,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "WORK_FLOW_LINEAGE_TAG") @Api(tags = "WORK_FLOW_LINEAGE_TAG")
@RestController @RestController
@RequestMapping("lineages/{projectId}") @RequestMapping("lineages/{projectCode}")
public class WorkFlowLineageController extends BaseController { public class WorkFlowLineageController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(WorkFlowLineageController.class); private static final Logger logger = LoggerFactory.getLogger(WorkFlowLineageController.class);
...@@ -66,14 +66,14 @@ public class WorkFlowLineageController extends BaseController { ...@@ -66,14 +66,14 @@ public class WorkFlowLineageController extends BaseController {
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<List<WorkFlowLineage>> queryWorkFlowLineageByName(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result<List<WorkFlowLineage>> queryWorkFlowLineageByName(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectId", value = "PROJECT_ID", required = true, example = "1") @PathVariable int projectId, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true, example = "1") @PathVariable long projectCode,
@ApiIgnore @RequestParam(value = "searchVal", required = false) String searchVal) { @ApiIgnore @RequestParam(value = "searchVal", required = false) String searchVal) {
try { try {
searchVal = ParameterUtils.handleEscapes(searchVal); searchVal = ParameterUtils.handleEscapes(searchVal);
Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByName(searchVal,projectId); Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByName(searchVal, projectCode);
return returnDataList(result); return returnDataList(result);
} catch (Exception e) { } catch (Exception e) {
logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(),e); logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(), e);
return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg()); return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg());
} }
} }
...@@ -83,7 +83,7 @@ public class WorkFlowLineageController extends BaseController { ...@@ -83,7 +83,7 @@ public class WorkFlowLineageController extends BaseController {
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<Map<String, Object>> queryWorkFlowLineageByIds(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser, public Result<Map<String, Object>> queryWorkFlowLineageByIds(@ApiIgnore @RequestAttribute(value = SESSION_USER) User loginUser,
@ApiParam(name = "projectId", value = "PROJECT_ID", required = true, example = "1") @PathVariable int projectId, @ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true, example = "1") @PathVariable long projectCode,
@ApiIgnore @RequestParam(value = "ids", required = false) String ids) { @ApiIgnore @RequestParam(value = "ids", required = false) String ids) {
try { try {
ids = ParameterUtils.handleEscapes(ids); ids = ParameterUtils.handleEscapes(ids);
...@@ -95,10 +95,10 @@ public class WorkFlowLineageController extends BaseController { ...@@ -95,10 +95,10 @@ public class WorkFlowLineageController extends BaseController {
} }
} }
Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByIds(idsSet, projectId); Map<String, Object> result = workFlowLineageService.queryWorkFlowLineageByIds(idsSet, projectCode);
return returnDataList(result); return returnDataList(result);
} catch (Exception e) { } catch (Exception e) {
logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(),e); logger.error(QUERY_WORKFLOW_LINEAGE_ERROR.getMsg(), e);
return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg()); return error(QUERY_WORKFLOW_LINEAGE_ERROR.getCode(), QUERY_WORKFLOW_LINEAGE_ERROR.getMsg());
} }
} }
......
...@@ -34,7 +34,9 @@ import java.util.Map; ...@@ -34,7 +34,9 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -53,7 +55,7 @@ import springfox.documentation.annotations.ApiIgnore; ...@@ -53,7 +55,7 @@ import springfox.documentation.annotations.ApiIgnore;
*/ */
@Api(tags = "WORKER_GROUP_TAG") @Api(tags = "WORKER_GROUP_TAG")
@RestController @RestController
@RequestMapping("/worker-group") @RequestMapping("/worker-groups")
public class WorkerGroupController extends BaseController { public class WorkerGroupController extends BaseController {
@Autowired @Autowired
...@@ -74,7 +76,7 @@ public class WorkerGroupController extends BaseController { ...@@ -74,7 +76,7 @@ public class WorkerGroupController extends BaseController {
@ApiImplicitParam(name = "name", value = "WORKER_GROUP_NAME", required = true, dataType = "String"), @ApiImplicitParam(name = "name", value = "WORKER_GROUP_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "addrList", value = "WORKER_ADDR_LIST", required = true, dataType = "String") @ApiImplicitParam(name = "addrList", value = "WORKER_ADDR_LIST", required = true, dataType = "String")
}) })
@PostMapping(value = "/save") @PostMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(SAVE_ERROR) @ApiException(SAVE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -102,7 +104,7 @@ public class WorkerGroupController extends BaseController { ...@@ -102,7 +104,7 @@ public class WorkerGroupController extends BaseController {
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "20"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String") @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String")
}) })
@GetMapping(value = "/list-paging") @GetMapping()
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_WORKER_GROUP_FAIL) @ApiException(QUERY_WORKER_GROUP_FAIL)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -128,7 +130,7 @@ public class WorkerGroupController extends BaseController { ...@@ -128,7 +130,7 @@ public class WorkerGroupController extends BaseController {
* @return all worker group list * @return all worker group list
*/ */
@ApiOperation(value = "queryAllWorkerGroups", notes = "QUERY_WORKER_GROUP_LIST_NOTES") @ApiOperation(value = "queryAllWorkerGroups", notes = "QUERY_WORKER_GROUP_LIST_NOTES")
@GetMapping(value = "/all-groups") @GetMapping(value = "/all")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_WORKER_GROUP_FAIL) @ApiException(QUERY_WORKER_GROUP_FAIL)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
...@@ -148,12 +150,12 @@ public class WorkerGroupController extends BaseController { ...@@ -148,12 +150,12 @@ public class WorkerGroupController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "WORKER_GROUP_ID", required = true, dataType = "Int", example = "10"), @ApiImplicitParam(name = "id", value = "WORKER_GROUP_ID", required = true, dataType = "Int", example = "10"),
}) })
@PostMapping(value = "/delete-by-id") @DeleteMapping(value = "/{id}")
@ResponseStatus(HttpStatus.OK) @ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_WORKER_GROUP_FAIL) @ApiException(DELETE_WORKER_GROUP_FAIL)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") @AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, public Result deleteById(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") Integer id @PathVariable("id") Integer id
) { ) {
Map<String, Object> result = workerGroupService.deleteWorkerGroupById(loginUser, id); Map<String, Object> result = workerGroupService.deleteWorkerGroupById(loginUser, id);
return returnDataList(result); return returnDataList(result);
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.dto;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.Schedule;
/**
* DagDataSchedule
*/
public class DagDataSchedule extends DagData {
/**
* schedule
*/
private Schedule schedule;
public DagDataSchedule(DagData dagData) {
super();
this.setProcessDefinition(dagData.getProcessDefinition());
this.setTaskDefinitionList(dagData.getTaskDefinitionList());
this.setProcessTaskRelationList(dagData.getProcessTaskRelationList());
}
public Schedule getSchedule() {
return schedule;
}
public void setSchedule(Schedule schedule) {
this.schedule = schedule;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.dto;
/**
* ProcessMeta
*/
public class ProcessMeta {
/**
* project name
*/
private String projectName;
/**
* process definition name
*/
private String processDefinitionName;
/**
* processs definition json
*/
private String processDefinitionJson;
/**
* process definition desc
*/
private String processDefinitionDescription;
/**
* process definition locations
*/
private String processDefinitionLocations;
/**
* process definition connects
*/
private String processDefinitionConnects;
/**
* warning type
*/
private String scheduleWarningType;
/**
* warning group id
*/
private Integer scheduleWarningGroupId;
/**
* warning group name
*/
private String scheduleWarningGroupName;
/**
* start time
*/
private String scheduleStartTime;
/**
* end time
*/
private String scheduleEndTime;
/**
* crontab
*/
private String scheduleCrontab;
/**
* failure strategy
*/
private String scheduleFailureStrategy;
/**
* release state
*/
private String scheduleReleaseState;
/**
* process instance priority
*/
private String scheduleProcessInstancePriority;
/**
* worker group name
*/
private String scheduleWorkerGroupName;
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public String getProcessDefinitionName() {
return processDefinitionName;
}
public void setProcessDefinitionName(String processDefinitionName) {
this.processDefinitionName = processDefinitionName;
}
public String getProcessDefinitionJson() {
return processDefinitionJson;
}
public void setProcessDefinitionJson(String processDefinitionJson) {
this.processDefinitionJson = processDefinitionJson;
}
public String getProcessDefinitionDescription() {
return processDefinitionDescription;
}
public void setProcessDefinitionDescription(String processDefinitionDescription) {
this.processDefinitionDescription = processDefinitionDescription;
}
public String getProcessDefinitionLocations() {
return processDefinitionLocations;
}
public void setProcessDefinitionLocations(String processDefinitionLocations) {
this.processDefinitionLocations = processDefinitionLocations;
}
public String getProcessDefinitionConnects() {
return processDefinitionConnects;
}
public void setProcessDefinitionConnects(String processDefinitionConnects) {
this.processDefinitionConnects = processDefinitionConnects;
}
public String getScheduleWarningType() {
return scheduleWarningType;
}
public void setScheduleWarningType(String scheduleWarningType) {
this.scheduleWarningType = scheduleWarningType;
}
public Integer getScheduleWarningGroupId() {
return scheduleWarningGroupId;
}
public void setScheduleWarningGroupId(int scheduleWarningGroupId) {
this.scheduleWarningGroupId = scheduleWarningGroupId;
}
public String getScheduleWarningGroupName() {
return scheduleWarningGroupName;
}
public void setScheduleWarningGroupName(String scheduleWarningGroupName) {
this.scheduleWarningGroupName = scheduleWarningGroupName;
}
public String getScheduleStartTime() {
return scheduleStartTime;
}
public void setScheduleStartTime(String scheduleStartTime) {
this.scheduleStartTime = scheduleStartTime;
}
public String getScheduleEndTime() {
return scheduleEndTime;
}
public void setScheduleEndTime(String scheduleEndTime) {
this.scheduleEndTime = scheduleEndTime;
}
public String getScheduleCrontab() {
return scheduleCrontab;
}
public void setScheduleCrontab(String scheduleCrontab) {
this.scheduleCrontab = scheduleCrontab;
}
public String getScheduleFailureStrategy() {
return scheduleFailureStrategy;
}
public void setScheduleFailureStrategy(String scheduleFailureStrategy) {
this.scheduleFailureStrategy = scheduleFailureStrategy;
}
public String getScheduleReleaseState() {
return scheduleReleaseState;
}
public void setScheduleReleaseState(String scheduleReleaseState) {
this.scheduleReleaseState = scheduleReleaseState;
}
public String getScheduleProcessInstancePriority() {
return scheduleProcessInstancePriority;
}
public void setScheduleProcessInstancePriority(String scheduleProcessInstancePriority) {
this.scheduleProcessInstancePriority = scheduleProcessInstancePriority;
}
public String getScheduleWorkerGroupName() {
return scheduleWorkerGroupName;
}
public void setScheduleWorkerGroupName(String scheduleWorkerGroupName) {
this.scheduleWorkerGroupName = scheduleWorkerGroupName;
}
}
...@@ -74,7 +74,7 @@ public enum Status { ...@@ -74,7 +74,7 @@ public enum Status {
LIST_WORKERS_ERROR(10044, "list workers error", "查询worker列表错误"), LIST_WORKERS_ERROR(10044, "list workers error", "查询worker列表错误"),
LIST_MASTERS_ERROR(10045, "list masters error", "查询master列表错误"), LIST_MASTERS_ERROR(10045, "list masters error", "查询master列表错误"),
UPDATE_PROJECT_ERROR(10046, "update project error", "更新项目信息错误"), UPDATE_PROJECT_ERROR(10046, "update project error", "更新项目信息错误"),
QUERY_PROJECT_DETAILS_BY_ID_ERROR(10047, "query project details by id error", "查询项目详细信息错误"), QUERY_PROJECT_DETAILS_BY_CODE_ERROR(10047, "query project details by code error", "查询项目详细信息错误"),
CREATE_PROJECT_ERROR(10048, "create project error", "创建项目错误"), CREATE_PROJECT_ERROR(10048, "create project error", "创建项目错误"),
LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR(10049, "login user query project list paging error", "分页查询项目列表错误"), LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR(10049, "login user query project list paging error", "分页查询项目列表错误"),
DELETE_PROJECT_ERROR(10050, "delete project error", "删除项目错误"), DELETE_PROJECT_ERROR(10050, "delete project error", "删除项目错误"),
...@@ -132,7 +132,7 @@ public enum Status { ...@@ -132,7 +132,7 @@ public enum Status {
AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"), AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"),
QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"), QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"),
DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"), DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"),
CREATE_PROCESS_DEFINITION(10105, "create process definition", "创建工作流错误"), CREATE_PROCESS_DEFINITION_ERROR(10105, "create process definition error", "创建工作流错误"),
VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"), VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"),
UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"), UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"),
RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"), RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"),
...@@ -184,17 +184,15 @@ public enum Status { ...@@ -184,17 +184,15 @@ public enum Status {
SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR(10153 SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR(10153
, "Switch process definition version error: not exists process definition version, [process definition id {0}] [version number {1}]", "切换工作流版本出错:工作流版本信息不存在,[工作流id {0}] [版本号 {1}]"), , "Switch process definition version error: not exists process definition version, [process definition id {0}] [version number {1}]", "切换工作流版本出错:工作流版本信息不存在,[工作流id {0}] [版本号 {1}]"),
QUERY_PROCESS_DEFINITION_VERSIONS_ERROR(10154, "query process definition versions error", "查询工作流历史版本信息出错"), QUERY_PROCESS_DEFINITION_VERSIONS_ERROR(10154, "query process definition versions error", "查询工作流历史版本信息出错"),
QUERY_PROCESS_DEFINITION_VERSIONS_PAGE_NO_OR_PAGE_SIZE_LESS_THAN_1_ERROR(10155
, "query process definition versions error: [page number:{0}] < 1 or [page size:{1}] < 1", "查询工作流历史版本出错:[pageNo:{0}] < 1 或 [pageSize:{1}] < 1"),
DELETE_PROCESS_DEFINITION_VERSION_ERROR(10156, "delete process definition version error", "删除工作流历史版本出错"), DELETE_PROCESS_DEFINITION_VERSION_ERROR(10156, "delete process definition version error", "删除工作流历史版本出错"),
QUERY_USER_CREATED_PROJECT_ERROR(10157, "query user created project error error", "查询用户创建的项目错误"), QUERY_USER_CREATED_PROJECT_ERROR(10157, "query user created project error error", "查询用户创建的项目错误"),
PROCESS_DEFINITION_IDS_IS_EMPTY(10158, "process definition ids is empty", "工作流IDS不能为空"), PROCESS_DEFINITION_CODES_IS_EMPTY(10158, "process definition codes is empty", "工作流CODES不能为空"),
BATCH_COPY_PROCESS_DEFINITION_ERROR(10159, "batch copy process definition error", "复制工作流错误"), BATCH_COPY_PROCESS_DEFINITION_ERROR(10159, "batch copy process definition error", "复制工作流错误"),
BATCH_MOVE_PROCESS_DEFINITION_ERROR(10160, "batch move process definition error", "移动工作流错误"), BATCH_MOVE_PROCESS_DEFINITION_ERROR(10160, "batch move process definition error", "移动工作流错误"),
QUERY_WORKFLOW_LINEAGE_ERROR(10161, "query workflow lineage error", "查询血缘失败"), QUERY_WORKFLOW_LINEAGE_ERROR(10161, "query workflow lineage error", "查询血缘失败"),
QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162, "query authorized and user created project error error", "查询授权的和用户创建的项目错误"), QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162, "query authorized and user created project error error", "查询授权的和用户创建的项目错误"),
DELETE_PROCESS_DEFINITION_BY_ID_FAIL(10163, "delete process definition by id fail, for there are {0} process instances in executing using it", "删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"), DELETE_PROCESS_DEFINITION_BY_CODE_FAIL(10163, "delete process definition by code fail, for there are {0} process instances in executing using it", "删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"),
CHECK_OS_TENANT_CODE_ERROR(10164, "Please enter the English os tenant code", "请输入英文操作系统租户"), CHECK_OS_TENANT_CODE_ERROR(10164, "Please enter the English os tenant code", "请输入英文操作系统租户"),
FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"), FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"),
TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"), TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"),
...@@ -256,21 +254,30 @@ public enum Status { ...@@ -256,21 +254,30 @@ public enum Status {
PROCESS_NODE_HAS_CYCLE(50019, "process node has cycle", "流程节点间存在循环依赖"), PROCESS_NODE_HAS_CYCLE(50019, "process node has cycle", "流程节点间存在循环依赖"),
PROCESS_NODE_S_PARAMETER_INVALID(50020, "process node {0} parameter invalid", "流程节点[{0}]参数无效"), PROCESS_NODE_S_PARAMETER_INVALID(50020, "process node {0} parameter invalid", "流程节点[{0}]参数无效"),
PROCESS_DEFINE_STATE_ONLINE(50021, "process definition {0} is already on line", "工作流定义[{0}]已上线"), PROCESS_DEFINE_STATE_ONLINE(50021, "process definition {0} is already on line", "工作流定义[{0}]已上线"),
DELETE_PROCESS_DEFINE_BY_ID_ERROR(50022, "delete process definition by id error", "删除工作流定义错误"), DELETE_PROCESS_DEFINE_BY_CODE_ERROR(50022, "delete process definition by code error", "删除工作流定义错误"),
SCHEDULE_CRON_STATE_ONLINE(50023, "the status of schedule {0} is already on line", "调度配置[{0}]已上线"), SCHEDULE_CRON_STATE_ONLINE(50023, "the status of schedule {0} is already on line", "调度配置[{0}]已上线"),
DELETE_SCHEDULE_CRON_BY_ID_ERROR(50024, "delete schedule by id error", "删除调度配置错误"), DELETE_SCHEDULE_CRON_BY_ID_ERROR(50024, "delete schedule by id error", "删除调度配置错误"),
BATCH_DELETE_PROCESS_DEFINE_ERROR(50025, "batch delete process definition error", "批量删除工作流定义错误"), BATCH_DELETE_PROCESS_DEFINE_ERROR(50025, "batch delete process definition error", "批量删除工作流定义错误"),
BATCH_DELETE_PROCESS_DEFINE_BY_IDS_ERROR(50026, "batch delete process definition by ids {0} error", "批量删除工作流定义[{0}]错误"), BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR(50026, "batch delete process definition by codes {0} error", "批量删除工作流定义[{0}]错误"),
TENANT_NOT_SUITABLE(50027, "there is not any tenant suitable, please choose a tenant available.", "没有合适的租户,请选择可用的租户"), TENANT_NOT_SUITABLE(50027, "there is not any tenant suitable, please choose a tenant available.", "没有合适的租户,请选择可用的租户"),
EXPORT_PROCESS_DEFINE_BY_ID_ERROR(50028, "export process definition by id error", "导出工作流定义错误"), EXPORT_PROCESS_DEFINE_BY_ID_ERROR(50028, "export process definition by id error", "导出工作流定义错误"),
BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR(50028, "batch export process definition by ids error", "批量导出工作流定义错误"), BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR(50028, "batch export process definition by ids error", "批量导出工作流定义错误"),
IMPORT_PROCESS_DEFINE_ERROR(50029, "import process definition error", "导入工作流定义错误"), IMPORT_PROCESS_DEFINE_ERROR(50029, "import process definition error", "导入工作流定义错误"),
TASK_DEFINE_NOT_EXIST(50030, "task definition {0} does not exist", "任务定义[{0}]不存在"), TASK_DEFINE_NOT_EXIST(50030, "task definition {0} does not exist", "任务定义[{0}]不存在"),
DELETE_TASK_DEFINE_BY_CODE_ERROR(50031, "delete task definition by code error", "删除任务定义错误"),
DELETE_PROCESS_TASK_RELATION_ERROR(50032, "delete process task relation error", "删除工作流任务关系错误"), DELETE_PROCESS_TASK_RELATION_ERROR(50032, "delete process task relation error", "删除工作流任务关系错误"),
PROCESS_TASK_RELATION_NOT_EXIST(50033, "process task relation {0} does not exist", "工作流任务关系[{0}]不存在"), PROCESS_TASK_RELATION_NOT_EXIST(50033, "process task relation {0} does not exist", "工作流任务关系[{0}]不存在"),
PROCESS_TASK_RELATION_EXIST(50034, "process task relation is already exist, processCode:[{0}]", "工作流任务关系已存在, processCode:[{0}]"), PROCESS_TASK_RELATION_EXIST(50034, "process task relation is already exist, processCode:[{0}]", "工作流任务关系已存在, processCode:[{0}]"),
PROCESS_DAG_IS_EMPTY(50035, "process dag can not be empty", "工作流dag不能为空"), PROCESS_DAG_IS_EMPTY(50035, "process dag can not be empty", "工作流dag不能为空"),
CHECK_PROCESS_TASK_RELATION_ERROR(50036, "check process task relation error", "工作流任务关系参数错误"),
CREATE_TASK_DEFINITION_ERROR(50037, "create task definition error", "创建任务错误"),
UPDATE_TASK_DEFINITION_ERROR(50038, "update task definition error", "更新任务定义错误"),
QUERY_TASK_DEFINITION_VERSIONS_ERROR(50039, "query task definition versions error", "查询任务历史版本信息出错"),
SWITCH_TASK_DEFINITION_VERSION_ERROR(50040, "Switch task definition version error", "切换任务版本出错"),
DELETE_TASK_DEFINITION_VERSION_ERROR(50041, "delete task definition version error", "删除任务历史版本出错"),
DELETE_TASK_DEFINE_BY_CODE_ERROR(50042, "delete task definition by code error", "删除任务定义错误"),
QUERY_DETAIL_OF_TASK_DEFINITION_ERROR(50043, "query detail of task definition error", "查询任务详细信息错误"),
QUERY_TASK_DEFINITION_LIST_PAGING_ERROR(50044, "query task definition list paging error", "分页查询任务定义列表错误"),
TASK_DEFINITION_NAME_EXISTED(50045, "task definition name [{0}] already exists", "任务定义名称[{0}]已经存在"),
HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"), HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"),
/** /**
......
...@@ -30,51 +30,47 @@ public interface DataAnalysisService { ...@@ -30,51 +30,47 @@ public interface DataAnalysisService {
* statistical task instance status data * statistical task instance status data
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param projectCode project code
* @param startDate start date * @param startDate start date
* @param endDate end date * @param endDate end date
* @return task state count data * @return task state count data
*/ */
Map<String, Object> countTaskStateByProject(User loginUser, int projectId, String startDate, String endDate); Map<String, Object> countTaskStateByProject(User loginUser, long projectCode, String startDate, String endDate);
/** /**
* statistical process instance status data * statistical process instance status data
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param projectCode project code
* @param startDate start date * @param startDate start date
* @param endDate end date * @param endDate end date
* @return process instance state count data * @return process instance state count data
*/ */
Map<String, Object> countProcessInstanceStateByProject(User loginUser, int projectId, String startDate, String endDate); Map<String, Object> countProcessInstanceStateByProject(User loginUser, long projectCode, String startDate, String endDate);
/** /**
* statistics the process definition quantities of certain person * statistics the process definition quantities of certain person
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param projectCode project code
* @return definition count data * @return definition count data
*/ */
Map<String, Object> countDefinitionByUser(User loginUser, int projectId); Map<String, Object> countDefinitionByUser(User loginUser, long projectCode);
/** /**
* statistical command status data * statistical command status data
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id
* @param startDate start date
* @param endDate end date
* @return command state count data * @return command state count data
*/ */
Map<String, Object> countCommandState(User loginUser, int projectId, String startDate, String endDate); Map<String, Object> countCommandState(User loginUser);
/** /**
* count queue state * count queue state
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id
* @return queue state count data * @return queue state count data
*/ */
Map<String, Object> countQueueState(User loginUser, int projectId); Map<String, Object> countQueueState(User loginUser);
} }
...@@ -38,8 +38,8 @@ public interface ExecutorService { ...@@ -38,8 +38,8 @@ public interface ExecutorService {
* execute process instance * execute process instance
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionId process Definition Id * @param processDefinitionCode process definition code
* @param cronTime cron time * @param cronTime cron time
* @param commandType command type * @param commandType command type
* @param failureStrategy failuer strategy * @param failureStrategy failuer strategy
...@@ -56,8 +56,8 @@ public interface ExecutorService { ...@@ -56,8 +56,8 @@ public interface ExecutorService {
* @param expectedParallelismNumber the expected parallelism number when execute complement in parallel mode * @param expectedParallelismNumber the expected parallelism number when execute complement in parallel mode
* @return execute process instance code * @return execute process instance code
*/ */
Map<String, Object> execProcessInstance(User loginUser, String projectName, Map<String, Object> execProcessInstance(User loginUser, long projectCode,
int processDefinitionId, String cronTime, CommandType commandType, long processDefinitionCode, String cronTime, CommandType commandType,
FailureStrategy failureStrategy, String startNodeList, FailureStrategy failureStrategy, String startNodeList,
TaskDependType taskDependType, WarningType warningType, int warningGroupId, TaskDependType taskDependType, WarningType warningType, int warningGroupId,
RunMode runMode, RunMode runMode,
...@@ -77,18 +77,18 @@ public interface ExecutorService { ...@@ -77,18 +77,18 @@ public interface ExecutorService {
* do action to process instance:pause, stop, repeat, recover from pause, recover from stop * do action to process instance:pause, stop, repeat, recover from pause, recover from stop
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processInstanceId process instance id * @param processInstanceId process instance id
* @param executeType execute type * @param executeType execute type
* @return execute result code * @return execute result code
*/ */
Map<String, Object> execute(User loginUser, String projectName, Integer processInstanceId, ExecuteType executeType); Map<String, Object> execute(User loginUser, long projectCode, Integer processInstanceId, ExecuteType executeType);
/** /**
* check if sub processes are offline before starting process definition * check if sub processes are offline before starting process definition
* *
* @param processDefineId process definition id * @param processDefinitionCode process definition code
* @return check result code * @return check result code
*/ */
Map<String, Object> startCheckByProcessDefinedId(int processDefineId); Map<String, Object> startCheckByProcessDefinedCode(long processDefinitionCode);
} }
...@@ -19,7 +19,6 @@ package org.apache.dolphinscheduler.api.service; ...@@ -19,7 +19,6 @@ package org.apache.dolphinscheduler.api.service;
import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.dao.entity.ProcessData;
import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map; import java.util.Map;
...@@ -28,8 +27,6 @@ import javax.servlet.http.HttpServletResponse; ...@@ -28,8 +27,6 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.JsonProcessingException;
/** /**
* process definition service * process definition service
*/ */
...@@ -39,38 +36,43 @@ public interface ProcessDefinitionService { ...@@ -39,38 +36,43 @@ public interface ProcessDefinitionService {
* create process definition * create process definition
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param name process definition name * @param name process definition name
* @param processDefinitionJson process definition json * @param description description
* @param desc description * @param globalParams global params
* @param locations locations for nodes * @param locations locations for nodes
* @param connects connects for nodes * @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return create result code * @return create result code
* @throws JsonProcessingException JsonProcessingException
*/ */
Map<String, Object> createProcessDefinition(User loginUser, Map<String, Object> createProcessDefinition(User loginUser,
String projectName, long projectCode,
String name, String name,
String processDefinitionJson, String description,
String desc, String globalParams,
String locations, String locations,
String connects) throws JsonProcessingException; int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson);
/** /**
* query process definition list * query process definition list
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @return definition list * @return definition list
*/ */
Map<String, Object> queryProcessDefinitionList(User loginUser, Map<String, Object> queryProcessDefinitionList(User loginUser,
String projectName); long projectCode);
/** /**
* query process definition list paging * query process definition list paging
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param searchVal search value * @param searchVal search value
* @param pageNo page number * @param pageNo page number
* @param pageSize page size * @param pageSize page size
...@@ -78,236 +80,247 @@ public interface ProcessDefinitionService { ...@@ -78,236 +80,247 @@ public interface ProcessDefinitionService {
* @return process definition page * @return process definition page
*/ */
Result queryProcessDefinitionListPaging(User loginUser, Result queryProcessDefinitionListPaging(User loginUser,
String projectName, long projectCode,
String searchVal, String searchVal,
Integer userId,
Integer pageNo, Integer pageNo,
Integer pageSize, Integer pageSize);
Integer userId);
/** /**
* query datail of process definition * query detail of process definition
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processId process definition id * @param code process definition code
* @return process definition detail * @return process definition detail
*/ */
Map<String, Object> queryProcessDefinitionById(User loginUser, Map<String, Object> queryProcessDefinitionByCode(User loginUser,
String projectName, long projectCode,
Integer processId); long code);
/** /**
* query datail of process definition * query detail of process definition
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionName process definition name * @param name process definition name
* @return process definition detail * @return process definition detail
*/ */
Map<String, Object> queryProcessDefinitionByName(User loginUser, Map<String, Object> queryProcessDefinitionByName(User loginUser,
String projectName, long projectCode,
String processDefinitionName); String name);
/** /**
* batch copy process definition * batch copy process definition
* *
* @param loginUser loginUser * @param loginUser loginUser
* @param projectName projectName * @param projectCode projectCode
* @param processDefinitionIds processDefinitionIds * @param codes processDefinitionCodes
* @param targetProjectId targetProjectId * @param targetProjectCode targetProjectCode
*/ */
Map<String, Object> batchCopyProcessDefinition(User loginUser, Map<String, Object> batchCopyProcessDefinition(User loginUser,
String projectName, long projectCode,
String processDefinitionIds, String codes,
int targetProjectId); long targetProjectCode);
/** /**
* batch move process definition * batch move process definition
* *
* @param loginUser loginUser * @param loginUser loginUser
* @param projectName projectName * @param projectCode projectCode
* @param processDefinitionIds processDefinitionIds * @param codes processDefinitionCodes
* @param targetProjectId targetProjectId * @param targetProjectCode targetProjectCode
*/ */
Map<String, Object> batchMoveProcessDefinition(User loginUser, Map<String, Object> batchMoveProcessDefinition(User loginUser,
String projectName, long projectCode,
String processDefinitionIds, String codes,
int targetProjectId); long targetProjectCode);
/** /**
* update process definition * update process definition
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param name process definition name * @param name process definition name
* @param id process definition id * @param code process definition code
* @param processDefinitionJson process definition json * @param description description
* @param desc description * @param globalParams global params
* @param locations locations for nodes * @param locations locations for nodes
* @param connects connects for nodes * @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @return update result code * @return update result code
*/ */
Map<String, Object> updateProcessDefinition(User loginUser, Map<String, Object> updateProcessDefinition(User loginUser,
String projectName, long projectCode,
int id,
String name, String name,
String processDefinitionJson, String desc, long code,
String locations, String connects); String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson);
/** /**
* verify process definition name unique * verify process definition name unique
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param name name * @param name name
* @return true if process definition name not exists, otherwise false * @return true if process definition name not exists, otherwise false
*/ */
Map<String, Object> verifyProcessDefinitionName(User loginUser, Map<String, Object> verifyProcessDefinitionName(User loginUser,
String projectName, long projectCode,
String name); String name);
/** /**
* delete process definition by id * delete process definition by code
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionId process definition id * @param code process definition code
* @return delete result code * @return delete result code
*/ */
Map<String, Object> deleteProcessDefinitionById(User loginUser, Map<String, Object> deleteProcessDefinitionByCode(User loginUser,
String projectName, long projectCode,
Integer processDefinitionId); long code);
/** /**
* release process definition: online / offline * release process definition: online / offline
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param id process definition id * @param code process definition code
* @param releaseState release state * @param releaseState release state
* @return release result code * @return release result code
*/ */
Map<String, Object> releaseProcessDefinition(User loginUser, Map<String, Object> releaseProcessDefinition(User loginUser,
String projectName, long projectCode,
int id, long code,
ReleaseState releaseState); ReleaseState releaseState);
/** /**
* batch export process definition by ids * batch export process definition by codes
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionIds process definition ids * @param codes process definition codes
* @param response http servlet response * @param response http servlet response
*/ */
void batchExportProcessDefinitionByIds(User loginUser, void batchExportProcessDefinitionByCodes(User loginUser,
String projectName, long projectCode,
String processDefinitionIds, String codes,
HttpServletResponse response); HttpServletResponse response);
/** /**
* import process definition * import process definition
* *
* @param loginUser login user * @param loginUser login user
* @param projectCode project code
* @param file process metadata json file * @param file process metadata json file
* @param currentProjectName current project name
* @return import process * @return import process
*/ */
Map<String, Object> importProcessDefinition(User loginUser, Map<String, Object> importProcessDefinition(User loginUser,
MultipartFile file, long projectCode,
String currentProjectName); MultipartFile file);
/** /**
* check the process definition node meets the specifications * check the process task relation json
* *
* @param processData process data * @param processTaskRelationJson process task relation json
* @param processDefinitionJson process definition json
* @return check result code * @return check result code
*/ */
Map<String, Object> checkProcessNodeList(ProcessData processData, Map<String, Object> checkProcessNodeList(String processTaskRelationJson);
String processDefinitionJson);
/** /**
* get task node details based on process definition * get task node details based on process definition
* *
* @param defineCode define code * @param loginUser loginUser
* @param projectCode project code
* @param code processDefinition code
* @return task node list * @return task node list
*/ */
Map<String, Object> getTaskNodeListByDefinitionCode(Long defineCode); Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser,
long projectCode,
long code);
/** /**
* get task node details based on process definition * get task node details map based on process definition
* *
* @param defineCodeList define code list * @param loginUser loginUser
* @param projectCode project code
* @param codes define code list
* @return task node list * @return task node list
*/ */
Map<String, Object> getTaskNodeListByDefinitionCodeList(String defineCodeList); Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser,
long projectCode,
String codes);
/** /**
* query process definition all by project id * query process definition all by project code
* *
* @param projectId project id * @param projectCode project code
* @return process definitions in the project * @return process definitions in the project
*/ */
Map<String, Object> queryProcessDefinitionAllByProjectId(Integer projectId); Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode);
/** /**
* Encapsulates the TreeView structure * Encapsulates the TreeView structure
* *
* @param processId process definition id * @param code process definition code
* @param limit limit * @param limit limit
* @return tree view json data * @return tree view json data
* @throws Exception exception
*/ */
Map<String, Object> viewTree(Integer processId, Map<String, Object> viewTree(long code, Integer limit);
Integer limit) throws Exception;
/** /**
* switch the defined process definition verison * switch the defined process definition version
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefinitionId process definition id * @param code process definition code
* @param version the version user want to switch * @param version the version user want to switch
* @return switch process definition version result code * @return switch process definition version result code
*/ */
Map<String, Object> switchProcessDefinitionVersion(User loginUser, String projectName Map<String, Object> switchProcessDefinitionVersion(User loginUser,
, int processDefinitionId, long version); long projectCode,
long code,
int version);
/** /**
* query the pagination versions info by one certain process definition code * query the pagination versions info by one certain process definition code
* *
* @param loginUser login user info to check auth * @param loginUser login user info to check auth
* @param projectName process definition project name * @param projectCode project code
* @param pageNo page number * @param pageNo page number
* @param pageSize page size * @param pageSize page size
* @param processDefinitionCode process definition code * @param code process definition code
* @return the pagination process definition versions info of the certain process definition * @return the pagination process definition versions info of the certain process definition
*/ */
Result queryProcessDefinitionVersions(User loginUser, String projectName, Result queryProcessDefinitionVersions(User loginUser,
int pageNo, int pageSize, long processDefinitionCode); long projectCode,
int pageNo,
int pageSize,
long code);
/** /**
* delete one certain process definition by version number and process definition id * delete one certain process definition by version number and process definition code
* *
* @param loginUser login user info to check auth * @param loginUser login user info to check auth
* @param projectName process definition project name * @param projectCode project code
* @param processDefinitionId process definition id * @param code process definition code
* @param version version number * @param version version number
* @return delele result code * @return delele result code
*/ */
Map<String, Object> deleteByProcessDefinitionIdAndVersion(User loginUser, String projectName, Map<String, Object> deleteProcessDefinitionVersion(User loginUser,
int processDefinitionId, long version); long projectCode,
long code,
int version);
/**
* check has associated process definition
*
* @param processDefinitionId process definition id
* @param version version
* @return The query result has a specific process definition return true
*/
boolean checkHasAssociatedProcessDefinition(int processDefinitionId, long version);
} }
...@@ -26,7 +26,6 @@ import org.apache.dolphinscheduler.dao.entity.ProcessInstance; ...@@ -26,7 +26,6 @@ import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.User;
import java.io.IOException; import java.io.IOException;
import java.text.ParseException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -39,26 +38,32 @@ public interface ProcessInstanceService { ...@@ -39,26 +38,32 @@ public interface ProcessInstanceService {
/** /**
* return top n SUCCESS process instance order by running time which started between startTime and endTime * return top n SUCCESS process instance order by running time which started between startTime and endTime
*/ */
Map<String, Object> queryTopNLongestRunningProcessInstance(User loginUser, String projectName, int size, String startTime, String endTime); Map<String, Object> queryTopNLongestRunningProcessInstance(User loginUser,
long projectCode,
int size,
String startTime,
String endTime);
/** /**
* query process instance by id * query process instance by id
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processId process instance id * @param processId process instance id
* @return process instance detail * @return process instance detail
*/ */
Map<String, Object> queryProcessInstanceById(User loginUser, String projectName, Integer processId); Map<String, Object> queryProcessInstanceById(User loginUser,
long projectCode,
Integer processId);
/** /**
* paging query process instance list, filtering according to project, process definition, time range, keyword, process status * paging query process instance list, filtering according to project, process definition, time range, keyword, process status
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param pageNo page number * @param pageNo page number
* @param pageSize page size * @param pageSize page size
* @param processDefineId process definition id * @param processDefineCode process definition code
* @param searchVal search value * @param searchVal search value
* @param stateType state type * @param stateType state type
* @param host host * @param host host
...@@ -66,21 +71,30 @@ public interface ProcessInstanceService { ...@@ -66,21 +71,30 @@ public interface ProcessInstanceService {
* @param endDate end time * @param endDate end time
* @return process instance list * @return process instance list
*/ */
Result queryProcessInstanceList(User loginUser, String projectName, Integer processDefineId, Result queryProcessInstanceList(User loginUser,
String startDate, String endDate, long projectCode,
String searchVal, String executorName, ExecutionStatus stateType, String host, long processDefineCode,
Integer pageNo, Integer pageSize); String startDate,
String endDate,
String searchVal,
String executorName,
ExecutionStatus stateType,
String host,
Integer pageNo,
Integer pageSize);
/** /**
* query task list by process instance id * query task list by process instance id
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processId process instance id * @param processId process instance id
* @return task list for the process instance * @return task list for the process instance
* @throws IOException io exception * @throws IOException io exception
*/ */
Map<String, Object> queryTaskListByProcessId(User loginUser, String projectName, Integer processId) throws IOException; Map<String, Object> queryTaskListByProcessId(User loginUser,
long projectCode,
Integer processId) throws IOException;
Map<String, DependResult> parseLogForDependentResult(String log) throws IOException; Map<String, DependResult> parseLogForDependentResult(String log) throws IOException;
...@@ -88,50 +102,65 @@ public interface ProcessInstanceService { ...@@ -88,50 +102,65 @@ public interface ProcessInstanceService {
* query sub process instance detail info by task id * query sub process instance detail info by task id
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param taskId task id * @param taskId task id
* @return sub process instance detail * @return sub process instance detail
*/ */
Map<String, Object> querySubProcessInstanceByTaskId(User loginUser, String projectName, Integer taskId); Map<String, Object> querySubProcessInstanceByTaskId(User loginUser,
long projectCode,
Integer taskId);
/** /**
* update process instance * update process instance
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processInstanceJson process instance json * @param taskRelationJson process task relation json
* @param taskDefinitionJson taskDefinitionJson
* @param processInstanceId process instance id * @param processInstanceId process instance id
* @param scheduleTime schedule time * @param scheduleTime schedule time
* @param syncDefine sync define * @param syncDefine sync define
* @param flag flag * @param globalParams global params
* @param locations locations * @param locations locations for nodes
* @param connects connects * @param timeout timeout
* @param tenantCode tenantCode
* @return update result code * @return update result code
* @throws ParseException parse exception for json parse
*/ */
Map<String, Object> updateProcessInstance(User loginUser, String projectName, Integer processInstanceId, Map<String, Object> updateProcessInstance(User loginUser,
String processInstanceJson, String scheduleTime, Boolean syncDefine, long projectCode,
Flag flag, String locations, String connects) throws ParseException; Integer processInstanceId,
String taskRelationJson,
String taskDefinitionJson,
String scheduleTime,
Boolean syncDefine,
String globalParams,
String locations,
int timeout,
String tenantCode);
/** /**
* query parent process instance detail info by sub process instance id * query parent process instance detail info by sub process instance id
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param subId sub process id * @param subId sub process id
* @return parent instance detail * @return parent instance detail
*/ */
Map<String, Object> queryParentInstanceBySubId(User loginUser, String projectName, Integer subId); Map<String, Object> queryParentInstanceBySubId(User loginUser,
long projectCode,
Integer subId);
/** /**
* delete process instance by id, at the same time,delete task instance and their mapping relation data * delete process instance by id, at the same time,delete task instance and their mapping relation data
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processInstanceId process instance id * @param processInstanceId process instance id
* @return delete result code * @return delete result code
*/ */
Map<String, Object> deleteProcessInstanceById(User loginUser, String projectName, Integer processInstanceId); Map<String, Object> deleteProcessInstanceById(User loginUser,
long projectCode,
Integer processInstanceId);
/** /**
* view process instance variables * view process instance variables
...@@ -157,7 +186,8 @@ public interface ProcessInstanceService { ...@@ -157,7 +186,8 @@ public interface ProcessInstanceService {
* @param states states array * @param states states array
* @return process instance list * @return process instance list
*/ */
List<ProcessInstance> queryByProcessDefineCodeAndStatus(Long processDefinitionCode, int[] states); List<ProcessInstance> queryByProcessDefineCodeAndStatus(Long processDefinitionCode,
int[] states);
/** /**
* query process instance by processDefinitionCode * query process instance by processDefinitionCode
...@@ -166,6 +196,6 @@ public interface ProcessInstanceService { ...@@ -166,6 +196,6 @@ public interface ProcessInstanceService {
* @param size size * @param size size
* @return process instance list * @return process instance list
*/ */
List<ProcessInstance> queryByProcessDefineCode(Long processDefinitionCode,int size); List<ProcessInstance> queryByProcessDefineCode(Long processDefinitionCode,
int size);
} }
\ No newline at end of file
...@@ -39,22 +39,22 @@ public interface ProjectService { ...@@ -39,22 +39,22 @@ public interface ProjectService {
Map<String, Object> createProject(User loginUser, String name, String desc); Map<String, Object> createProject(User loginUser, String name, String desc);
/** /**
* query project details by id * query project details by code
* *
* @param projectId project id * @param projectCode project code
* @return project detail information * @return project detail information
*/ */
Map<String, Object> queryById(Integer projectId); Map<String, Object> queryByCode(User loginUser, long projectCode);
/** /**
* check project and authorization * check project and authorization
* *
* @param loginUser login user * @param loginUser login user
* @param project project * @param project project
* @param projectName project name * @param projectCode project code
* @return true if the login user have permission to see the project * @return true if the login user have permission to see the project
*/ */
Map<String, Object> checkProjectAndAuth(User loginUser, Project project, String projectName); Map<String, Object> checkProjectAndAuth(User loginUser, Project project, long projectCode);
boolean hasProjectAndPerm(User loginUser, Project project, Map<String, Object> result); boolean hasProjectAndPerm(User loginUser, Project project, Map<String, Object> result);
...@@ -72,25 +72,25 @@ public interface ProjectService { ...@@ -72,25 +72,25 @@ public interface ProjectService {
Result queryProjectListPaging(User loginUser, Integer pageSize, Integer pageNo, String searchVal); Result queryProjectListPaging(User loginUser, Integer pageSize, Integer pageNo, String searchVal);
/** /**
* delete project by id * delete project by code
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param projectCode project code
* @return delete result code * @return delete result code
*/ */
Map<String, Object> deleteProject(User loginUser, Integer projectId); Map<String, Object> deleteProject(User loginUser, Long projectCode);
/** /**
* updateProcessInstance project * updateProcessInstance project
* *
* @param loginUser login user * @param loginUser login user
* @param projectId project id * @param projectCode project code
* @param projectName project name * @param projectName project name
* @param desc description * @param desc description
* @param userName project owner * @param userName project owner
* @return update result code * @return update result code
*/ */
Map<String, Object> update(User loginUser, Integer projectId, String projectName, String desc, String userName); Map<String, Object> update(User loginUser, Long projectCode, String projectName, String desc, String userName);
/** /**
* query unauthorized project * query unauthorized project
...@@ -127,8 +127,8 @@ public interface ProjectService { ...@@ -127,8 +127,8 @@ public interface ProjectService {
/** /**
* query authorized and user create project list by user id * query authorized and user create project list by user id
* @param loginUser * @param loginUser login user
* @return * @return project list
*/ */
Map<String, Object> queryProjectCreatedAndAuthorizedByUser(User loginUser); Map<String, Object> queryProjectCreatedAndAuthorizedByUser(User loginUser);
......
...@@ -35,8 +35,8 @@ public interface SchedulerService { ...@@ -35,8 +35,8 @@ public interface SchedulerService {
* save schedule * save schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefineId process definition id * @param processDefineCode process definition code
* @param schedule scheduler * @param schedule scheduler
* @param warningType warning type * @param warningType warning type
* @param warningGroupId warning group id * @param warningGroupId warning group id
...@@ -46,8 +46,9 @@ public interface SchedulerService { ...@@ -46,8 +46,9 @@ public interface SchedulerService {
* @param environmentCode environment code * @param environmentCode environment code
* @return create result code * @return create result code
*/ */
Map<String, Object> insertSchedule(User loginUser, String projectName, Map<String, Object> insertSchedule(User loginUser,
Integer processDefineId, long projectCode,
long processDefineCode,
String schedule, String schedule,
WarningType warningType, WarningType warningType,
int warningGroupId, int warningGroupId,
...@@ -60,7 +61,7 @@ public interface SchedulerService { ...@@ -60,7 +61,7 @@ public interface SchedulerService {
* updateProcessInstance schedule * updateProcessInstance schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param id scheduler id * @param id scheduler id
* @param scheduleExpression scheduler * @param scheduleExpression scheduler
* @param warningType warning type * @param warningType warning type
...@@ -69,17 +70,15 @@ public interface SchedulerService { ...@@ -69,17 +70,15 @@ public interface SchedulerService {
* @param workerGroup worker group * @param workerGroup worker group
* @param environmentCode environment code * @param environmentCode environment code
* @param processInstancePriority process instance priority * @param processInstancePriority process instance priority
* @param scheduleStatus schedule status
* @return update result code * @return update result code
*/ */
Map<String, Object> updateSchedule(User loginUser, Map<String, Object> updateSchedule(User loginUser,
String projectName, long projectCode,
Integer id, Integer id,
String scheduleExpression, String scheduleExpression,
WarningType warningType, WarningType warningType,
int warningGroupId, int warningGroupId,
FailureStrategy failureStrategy, FailureStrategy failureStrategy,
ReleaseState scheduleStatus,
Priority processInstancePriority, Priority processInstancePriority,
String workerGroup, String workerGroup,
Long environmentCode); Long environmentCode);
...@@ -89,13 +88,13 @@ public interface SchedulerService { ...@@ -89,13 +88,13 @@ public interface SchedulerService {
* set schedule online or offline * set schedule online or offline
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param id scheduler id * @param id scheduler id
* @param scheduleStatus schedule status * @param scheduleStatus schedule status
* @return publish result code * @return publish result code
*/ */
Map<String, Object> setScheduleState(User loginUser, Map<String, Object> setScheduleState(User loginUser,
String projectName, long projectCode,
Integer id, Integer id,
ReleaseState scheduleStatus); ReleaseState scheduleStatus);
...@@ -103,23 +102,24 @@ public interface SchedulerService { ...@@ -103,23 +102,24 @@ public interface SchedulerService {
* query schedule * query schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processDefineId process definition id * @param processDefineCode process definition code
* @param pageNo page number * @param pageNo page number
* @param pageSize page size * @param pageSize page size
* @param searchVal search value * @param searchVal search value
* @return schedule list page * @return schedule list page
*/ */
Result querySchedule(User loginUser, String projectName, Integer processDefineId, String searchVal, Integer pageNo, Integer pageSize); Result querySchedule(User loginUser, long projectCode, long processDefineCode, String searchVal,
Integer pageNo, Integer pageSize);
/** /**
* query schedule list * query schedule list
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @return schedule list * @return schedule list
*/ */
Map<String, Object> queryScheduleList(User loginUser, String projectName); Map<String, Object> queryScheduleList(User loginUser, long projectCode);
/** /**
* delete schedule * delete schedule
...@@ -134,19 +134,18 @@ public interface SchedulerService { ...@@ -134,19 +134,18 @@ public interface SchedulerService {
* delete schedule by id * delete schedule by id
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param scheduleId scheule id * @param scheduleId scheule id
* @return delete result code * @return delete result code
*/ */
Map<String, Object> deleteScheduleById(User loginUser, String projectName, Integer scheduleId); Map<String, Object> deleteScheduleById(User loginUser, long projectCode, Integer scheduleId);
/** /**
* preview schedule * preview schedule
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name
* @param schedule schedule expression * @param schedule schedule expression
* @return the next five fire time * @return the next five fire time
*/ */
Map<String, Object> previewSchedule(User loginUser, String projectName, String schedule); Map<String, Object> previewSchedule(User loginUser, String schedule);
} }
...@@ -32,7 +32,7 @@ public interface TaskInstanceService { ...@@ -32,7 +32,7 @@ public interface TaskInstanceService {
* query task list by project, process instance, task name, task start time, task end time, task status, keyword paging * query task list by project, process instance, task name, task start time, task end time, task status, keyword paging
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param processInstanceId process instance id * @param processInstanceId process instance id
* @param searchVal search value * @param searchVal search value
* @param taskName task name * @param taskName task name
...@@ -44,19 +44,29 @@ public interface TaskInstanceService { ...@@ -44,19 +44,29 @@ public interface TaskInstanceService {
* @param pageSize page size * @param pageSize page size
* @return task list page * @return task list page
*/ */
Result queryTaskListPaging(User loginUser, String projectName, Result queryTaskListPaging(User loginUser,
Integer processInstanceId, String processInstanceName, String taskName, String executorName, String startDate, long projectCode,
String endDate, String searchVal, ExecutionStatus stateType, String host, Integer processInstanceId,
Integer pageNo, Integer pageSize); String processInstanceName,
String taskName,
String executorName,
String startDate,
String endDate,
String searchVal,
ExecutionStatus stateType,
String host,
Integer pageNo,
Integer pageSize);
/** /**
* change one task instance's state from failure to forced success * change one task instance's state from failure to forced success
* *
* @param loginUser login user * @param loginUser login user
* @param projectName project name * @param projectCode project code
* @param taskInstanceId task instance id * @param taskInstanceId task instance id
* @return the result code and msg * @return the result code and msg
*/ */
Map<String, Object> forceTaskSuccess(User loginUser, String projectName, Integer taskInstanceId); Map<String, Object> forceTaskSuccess(User loginUser,
long projectCode,
Integer taskInstanceId);
} }
...@@ -25,8 +25,8 @@ import java.util.Set; ...@@ -25,8 +25,8 @@ import java.util.Set;
*/ */
public interface WorkFlowLineageService { public interface WorkFlowLineageService {
Map<String, Object> queryWorkFlowLineageByName(String workFlowName, int projectId); Map<String, Object> queryWorkFlowLineageByName(String workFlowName, long projectCode);
Map<String, Object> queryWorkFlowLineageByIds(Set<Integer> ids,int projectId); Map<String, Object> queryWorkFlowLineageByIds(Set<Integer> ids, long projectCode);
} }
...@@ -308,7 +308,8 @@ public class DataSourceServiceImpl extends BaseServiceImpl implements DataSource ...@@ -308,7 +308,8 @@ public class DataSourceServiceImpl extends BaseServiceImpl implements DataSource
* check connection * check connection
* *
* @param type data source type * @param type data source type
* @param connectionParam data source parameters * @param connectionParam connectionParam
* @return true if connect successfully, otherwise false
* @return true if connect successfully, otherwise false * @return true if connect successfully, otherwise false
*/ */
@Override @Override
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.ProcessTaskRelationService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* task definition service impl
*/
@Service
public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements
ProcessTaskRelationService {
private static final Logger logger = LoggerFactory.getLogger(ProcessTaskRelationServiceImpl.class);
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
/**
* query process task relation
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionCode process definition code
*/
@Override
public Map<String, Object> queryProcessTaskRelation(User loginUser, String projectName, Long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
// check project auth
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectName);
if (checkResult.get(Constants.STATUS) != Status.SUCCESS) {
return checkResult;
}
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(project.getCode(), processDefinitionCode);
result.put(Constants.DATA_LIST, processTaskRelationList);
putMsg(result, Status.SUCCESS);
return result;
}
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册