package com.xjrsoft.module.dev.rules;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.pictc.constant.ContractLiteflowRule;
import com.xjrsoft.module.liteflow.client.ILiteFlowChainClient;
import com.xjrsoft.module.liteflow.dto.LiteflowChainDto;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;

import shade.powerjob.com.google.common.collect.Maps;

@Component
public class RuleDemo {
	
	@Autowired
    private FlowExecutor flowExecutor;
	
	@Autowired
	private ILiteFlowChainClient liteflow;
    
    /**
     * @Description: 执行规则
     * @return void 返回类型
     */
    public void testConfig(){
        Map<String,Object> params = Maps.newHashMap();
        LiteflowChainDto dto = liteflow.getByName(ContractLiteflowRule.RULE_TEST);
        LiteflowResponse liteflowResponse = flowExecutor.execute2Resp(dto.getChainName(),params);
        System.out.println(liteflowResponse.isSuccess());
    }

}
