package com.yem.wm.es.exportinvoice.op;

import com.yem.wm.es.exportinvoice.validator.ExportInvoiceSubmitValidator;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.EndOperationTransactionArgs;

import java.util.Date;
import java.util.List;

/**
 * @author ljw
 * @date 2024/8/23 11:11
 * @description ExportInvoiceAuditOp
 */
public class ExportInvoiceAuditOp extends AbstractOperationServicePlugIn {
    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
        super.onPreparePropertys(e);
        List<String> fieldKeys = e.getFieldKeys();
        fieldKeys.add("auditdate");
        fieldKeys.add("yem_exratedate");
    }

    @Override
    public void endOperationTransaction(EndOperationTransactionArgs e) {
        super.endOperationTransaction(e);
        DynamicObject[] eDataEntities = e.getDataEntities();
        for (DynamicObject eDataEntity : eDataEntities) {
            Date date = eDataEntity.getDate("auditdate");
            eDataEntity.set("yem_exratedate",date);
        }
    }
}
