package nckd.jxccl.swc.mas.plugin.operate.base;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.validate.AbstractValidator;
import nckd.jxccl.swc.constants.MasConstant;

/**
* 延期支付比例
* 实体标识：nckd_deferpayratioconf
* @author W.Y.C
* @date 2025/12/2 14:59
* @version 1.0
*/
public class DeferPayRatioConfValidator extends AbstractValidator {

    @Override
    public void validate() {
        for (ExtendedDataEntity dataEntity : this.getDataEntities()) {
            DynamicObject data = dataEntity.getDataEntity();
            int payoutTimes = data.getInt(MasConstant.NCKD_PAYOUTTIMES);
            DynamicObjectCollection dynamicObjectCollection = data.getDynamicObjectCollection(MasConstant.NCKD_ENTRYENTITY);
            if(dynamicObjectCollection.size() != payoutTimes){
                this.addFatalErrorMessage(dataEntity,"【兑现比例】数量必须跟【支付总年数】一致");
            }

        }
    }
}