package net.ferrum.workflow.listener;

import cn.hutool.extra.spring.SpringUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.ferrum.common.constant.BusinessConstants;
import net.ferrum.common.enums.NoticeType;
import net.ferrum.flowable.utils.ProcessFormUtils;
import net.ferrum.system.domain.SysNotice;
import net.ferrum.system.service.ISysNoticeService;
import net.ferrum.workflow.service.IWfProcessService;
import org.flowable.engine.RuntimeService;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.ExecutionListener;
import org.flowable.engine.repository.ProcessDefinition;
import org.flowable.form.api.FormInfo;
import org.flowable.form.model.FormField;
import org.flowable.form.model.SimpleFormModel;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 发布规格事件监听类
 *
 * @author 26554
 * @version 1.0.0
 * @since 2025/2/18
 */

@Slf4j
@Component("TestListener")
@RequiredArgsConstructor
public class TestListener implements ExecutionListener {

    private final IWfProcessService processService;
    private final ISysNoticeService noticeService;

    @Override
    public void notify(DelegateExecution delegateExecution) {
        //System.out.println("设定 lbl_Core_weight = 2");
        //delegateExecution.setVariable("lbl_Core_weight", "2");
        // 获取所有流程变量
        Map<String, Object> allVariables = delegateExecution.getVariables();
        for (Map.Entry<String, Object> entry : allVariables.entrySet()) {
            String key = entry.getKey();
            Object value = entry.getValue();
            System.out.println("Key: " + key + ", Value: " + value);
        }
    }
}
