package nckd.jxccl.opmc.pm.plugin.form.salary;

import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.sdk.plugin.Plugin;
import nckd.jxccl.base.common.constant.FormConstant;
import nckd.jxccl.opmc.pm.common.SalAdjTrackerConstant;

import java.util.Arrays;
import java.util.stream.Stream;

/**
* 调薪情况列表插件
* @author W.Y.C
* @date 2025/6/9 18:43
* @version 1.0
*/
public class SalAdjtTackerListPlugin extends AbstractListPlugin implements Plugin {

    @Override
    public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
        String operateKey = afterDoOperationEventArgs.getOperateKey();
        if (afterDoOperationEventArgs.getOperationResult() != null && afterDoOperationEventArgs.getOperationResult().isSuccess()) {
            if (Stream.of(SalAdjTrackerConstant.NOPUSHADJUST_OP, SalAdjTrackerConstant.PUSHADJUST_OP)
                    .anyMatch(op -> op.equalsIgnoreCase(operateKey))) {
                this.getView().invokeOperation(FormConstant.REFRESH_OP);
            }
        }
    }
}