package nckd.jxccl.swc.mas.plugin.operate.structappr.change;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
import kd.sdk.plugin.Plugin;
import nckd.jxccl.base.common.constant.FormConstant;
import nckd.jxccl.swc.constants.MasConstant;

import java.util.Date;

/**
 * 子企业负责人正职年度薪酬核定标准-回写op
 * 实体标识：nckd_subcorpchiefsalstd
 * @author W.Y.C
 * @date 2025/12/3 20:03
 * @version 1.0
 */
public class SubcpChfSalstdChgBackOpPlugin extends AbstractSalaryStdChgOpPlugin implements Plugin {

    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
        e.getFieldKeys().addAll(this.billEntityType.getAllFields().keySet());
    }

    @Override
    public void beginOperationTransaction(BeginOperationTransactionArgs e) {
        super.beginOperationTransaction(e);
    }

    @Override
    protected String getEntityId() {
        return MasConstant.SUBCORPCHIEFSALSTD_ENTITYID;
    }

    @Override
    protected String getEntityName() {
        return "子企业负责人正职年度薪酬核定标准";
    }

    @Override
    protected void processBeforeUpdate(DynamicObject dataEntity, DynamicObject updateEntity) {
        updateEntity.set(FormConstant.MODIFY_TIME_KEY, new Date());
        dataEntity.set(FormConstant.MODIFIER_KEY, dataEntity.get(FormConstant.CREATOR_KEY));
    }
}