package com.zkqy.execution.produce.dispersed.service.impl.runbpm.hangye1.testNode;

import com.zkqy.common.core.domain.AjaxResult;
import com.zkqy.execution.produce.dispersed.entity.runbpm.BpmRunNodeFormFilterConditionsVo;
import com.zkqy.execution.produce.dispersed.entity.runbpm.BpmRunNodeFromVo;
import com.zkqy.execution.produce.dispersed.entity.runbpm.IRunBPMEntity;
import com.zkqy.execution.produce.dispersed.service.IRunBPMService;
import com.zkqy.execution.produce.utils.EchoNodeFormData;
import com.zkqy.system.entity.CommonEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service("42e32151-3899-47e5-9889-7640c6c9c4e2")
@Scope("prototype")
public class CaiGou implements IRunBPMService {

    @Autowired
    private EchoNodeFormData echoNodeFormData;

    @Override
    public CommonEntity getNodeFormData(BpmRunNodeFromVo bpmRunNodeFromVo) {
        BpmRunNodeFromVo bpmRunNodeFromVo1 = new BpmRunNodeFromVo();
        // 选择货品 list，当前表单中有个选择货品的下拉框
        Map<String, Object> map = new HashMap<>();
        map.put("del_flag", 0);
        bpmRunNodeFromVo.getFormDataVoList().add(new BpmRunNodeFormFilterConditionsVo("goods", map, false, "goodsList"));
        bpmRunNodeFromVo.getFormDataVoList().add(new BpmRunNodeFormFilterConditionsVo("caigou", map, true));
        return echoNodeFormData.getEchoNodeFormData(bpmRunNodeFromVo);
    }

    @Override
    public AjaxResult preValidation(IRunBPMEntity iRunBPMEntity) {
        return AjaxResult.success();
    }

    @Override
    public AjaxResult executeNode(IRunBPMEntity iRunBPMEntity) {
        Map<String,Object> map = iRunBPMEntity.getExecutionMap();
        CommonEntity commonEntity = new CommonEntity();
//        commonEntity.getCommMap().put("")

        return null;
    }

    @Override
    public AjaxResult afterValidation(IRunBPMEntity iRunBPMEntity) {
        return AjaxResult.success();
    }

    @Override
    public boolean isVerificationMethod() {
        return true;
    }

    @Override
    public boolean preDestroy() {
        return true;
    }
}
