package com.zkqy.execution.produce.dispersed.controller;

import com.zkqy.common.annotation.Log;
import com.zkqy.common.core.domain.AjaxResult;
import com.zkqy.common.enums.BusinessType;

import com.zkqy.execution.produce.dispersed.entity.runbpm.IScriptEntity;
import com.zkqy.execution.produce.dispersed.runbpm.RunImplementationClass;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author hanzihang
 * @date 2023/11/16 6:14 PM
 */
@RestController
@RequestMapping("/system/script")
public class BpmScriptController {

    @Resource
    private RunImplementationClass irunImplementationClass;

    /**
     * 共通投产流程接口
     */
    @Log(title = "脚本执行接口", businessType = BusinessType.UPDATE)
    @PostMapping("/execute")
    public AjaxResult productionScheduling(@RequestBody String scriptKey)   {
        IScriptEntity iScriptEntity = new IScriptEntity();
        iScriptEntity.setScriptFlowKey(scriptKey); // 脚本别名
        return AjaxResult.success(irunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity,scriptKey));
//        return AjaxResult.success(ipreExecutionToolClass.ReadyToExecute(intoProduction));
    }

}
