Commit c92347e6 authored by xiaobiesan's avatar xiaobiesan
Browse files

Merge remote-tracking branch 'upstream/dev' into HEAD

parents ceb2fd87 8eefa0e9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ Easy Scheduler

### 近期研发计划

EasyScheduler的工作计划:<a href="https://github.com/analysys/EasyScheduler/projects/1" target="_blank">研发计划</a> ,其中 In Develop卡片下是1.0.2版本的功能,TODO卡片是待做事项(包括 feature ideas)
EasyScheduler的工作计划:<a href="https://github.com/analysys/EasyScheduler/projects/1" target="_blank">研发计划</a> ,其中 In Develop卡片下是1.1.0版本的功能,TODO卡片是待做事项(包括 feature ideas)

### 贡献代码

+1 −1
Original line number Diff line number Diff line
# 快速上手

* 管理员用户登录
  >地址:192.168.xx.xx:8888 用户名密码:admin/esheduler123
  >地址:192.168.xx.xx:8888 用户名密码:admin/escheduler123

<p align="center">
   <img src="https://analysys.github.io/easyscheduler_docs_cn/images/login.jpg" width="60%" />
+42 −9
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ import cn.escheduler.api.utils.Constants;
import cn.escheduler.api.utils.Result;
import cn.escheduler.common.enums.*;
import cn.escheduler.dao.model.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,9 +38,9 @@ import static cn.escheduler.api.enums.Status.*;


/**
 * execute task controller
 * execute process controller
 */
@ApiIgnore
@Api(tags = "PROCESS_INSTANCE_EXECUTOR_TAG", position = 1)
@RestController
@RequestMapping("projects/{projectName}/executors")
public class ExecutorController extends BaseController {
@@ -53,10 +53,27 @@ public class ExecutorController extends BaseController {
    /**
     * execute process instance
     */
    @ApiOperation(value = "startProcessInstance", notes= "RUN_PROCESS_INSTANCE_NOTES")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
            @ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", required = true, dataType = "String"),
            @ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", required = true, dataType ="FailureStrategy"),
            @ApiImplicitParam(name = "startNodeList", value = "START_NODE_LIST", dataType ="String"),
            @ApiImplicitParam(name = "taskDependType", value = "TASK_DEPEND_TYPE", dataType ="TaskDependType"),
            @ApiImplicitParam(name = "execType", value = "COMMAND_TYPE", dataType ="CommandType"),
            @ApiImplicitParam(name = "warningType", value = "WARNING_TYPE",required = true, dataType ="WarningType"),
            @ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID",required = true, dataType ="Int", example = "100"),
            @ApiImplicitParam(name = "receivers", value = "RECEIVERS",dataType ="String" ),
            @ApiImplicitParam(name = "receiversCc", value = "RECEIVERS_CC",dataType ="String" ),
            @ApiImplicitParam(name = "runMode", value = "RUN_MODE",dataType ="RunMode" ),
            @ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", required = true, dataType = "Priority" ),
            @ApiImplicitParam(name = "workerGroupId", value = "WORKER_GROUP_ID", dataType = "Int",example = "100"),
            @ApiImplicitParam(name = "timeout", value = "TIMEOUT", dataType = "Int",example = "100"),
    })
    @PostMapping(value = "start-process-instance")
    @ResponseStatus(HttpStatus.OK)
    public Result startProcessInstance(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                                       @PathVariable String projectName,
    public Result startProcessInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                                       @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
                                       @RequestParam(value = "processDefinitionId") int processDefinitionId,
                                       @RequestParam(value = "scheduleTime", required = false) String scheduleTime,
                                       @RequestParam(value = "failureStrategy", required = true) FailureStrategy failureStrategy,
@@ -102,10 +119,15 @@ public class ExecutorController extends BaseController {
     * @param processInstanceId
     * @return
     */
    @ApiOperation(value = "execute", notes= "EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"),
            @ApiImplicitParam(name = "executeType", value = "EXECUTE_TYPE", required = true, dataType = "ExecuteType")
    })
    @PostMapping(value = "/execute")
    @ResponseStatus(HttpStatus.OK)
    public Result execute(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                                                  @PathVariable String projectName,
    public Result execute(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                          @ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
                                                  @RequestParam("processInstanceId") Integer processInstanceId,
                                                  @RequestParam("executeType") ExecuteType executeType
    ) {
@@ -127,9 +149,13 @@ public class ExecutorController extends BaseController {
     * @param processDefinitionId
     * @return
     */
    @ApiOperation(value = "startCheckProcessDefinition", notes= "START_CHECK_PROCESS_DEFINITION_NOTES")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
    })
    @PostMapping(value = "/start-check")
    @ResponseStatus(HttpStatus.OK)
    public Result startCheckProcessDefinition(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
    public Result startCheckProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                             @RequestParam(value = "processDefinitionId") int processDefinitionId) {
        logger.info("login user {}, check process definition", loginUser.getUserName(), processDefinitionId);
        try {
@@ -149,9 +175,16 @@ public class ExecutorController extends BaseController {
     * @param processDefinitionId
     * @return
     */
    @ApiIgnore
    @ApiOperation(value = "getReceiverCc", notes= "GET_RECEIVER_CC_NOTES")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
            @ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100")

    })
    @GetMapping(value = "/get-receiver-cc")
    @ResponseStatus(HttpStatus.OK)
    public Result getReceiverCc(@RequestAttribute(value = Constants.SESSION_USER) User loginUser,
    public Result getReceiverCc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
                                @RequestParam(value = "processDefinitionId",required = false) Integer processDefinitionId,
                                @RequestParam(value = "processInstanceId",required = false) Integer processInstanceId) {
        logger.info("login user {}, get process definition receiver and cc", loginUser.getUserName());
+6 −0
Original line number Diff line number Diff line
@@ -95,6 +95,9 @@ public class DependentUtils {
            case "last7Days":
                result = DependentDateUtils.getLastDayInterval(businessDate, 7);
                break;
            case "thisWeek":
                result = DependentDateUtils.getThisWeekInterval(businessDate);
                break;
            case "lastWeek":
                result = DependentDateUtils.getLastWeekInterval(businessDate);
                break;
@@ -119,6 +122,9 @@ public class DependentUtils {
            case "lastSunday":
                result = DependentDateUtils.getLastWeekOneDayInterval(businessDate, 7);
                break;
            case "thisMonth":
                result = DependentDateUtils.getThisMonthInterval(businessDate);
                break;
            case "lastMonth":
                result = DependentDateUtils.getLastMonthInterval(businessDate);
                break;
+20 −0
Original line number Diff line number Diff line
@@ -76,6 +76,16 @@ public class DependentDateUtils {
        return dateIntervals;
    }

    /**
     * get interval between this month first day and businessDate
     * @param businessDate
     * @return
     */
    public static List<DateInterval> getThisMonthInterval(Date businessDate) {
        Date firstDay = DateUtils.getFirstDayOfMonth(businessDate);
        return getDateIntervalListBetweenTwoDates(firstDay, businessDate);
    }

    /**
     * get interval between last month first day and last day
     * @param businessDate
@@ -108,6 +118,16 @@ public class DependentDateUtils {
        }
    }

    /**
     * get interval between monday to businessDate of this week
     * @param businessDate
     * @return
     */
    public static List<DateInterval> getThisWeekInterval(Date businessDate) {
        Date mondayThisWeek = DateUtils.getMonday(businessDate);
        return getDateIntervalListBetweenTwoDates(mondayThisWeek, businessDate);
    }

    /**
     * get interval between monday to sunday of last week
     * default set monday the first day of week
Loading