package cn.iocoder.yudao.module.bpm.service.task.listener;

import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author mark
 * @description 初始化金额
 * @date 2026-04-02
 */
@Component("initAmountTask")
@Slf4j
public class InitAmountTask implements JavaDelegate {
    private static final Logger log = LoggerFactory.getLogger(InitAmountTask.class);

    @Override
    public void execute(DelegateExecution execution) {
        log.info("报销金额:{}", execution.getVariable("amount"));
        if (execution.getVariable("amount") == null) {
            execution.setVariable("amount", 0);
        }
    }
}
