package yem.wm.bd.companyinfo.operation;

import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import yem.wm.bd.companyinfo.validator.CompanyInfoSaveValidator;

import java.util.List;

/**
 * @Description 公司抬头保存操作
 *              校验{银行信息}、{联系人信息}有且有唯一的默认值
 * @Author: zhangh
 * @CreateTime: 2025-02-08  17:05
 */
public class CompanyInfoSaveOpService extends AbstractOperationServicePlugIn {
    @Override
    public void onPreparePropertys(PreparePropertysEventArgs e) {
        List<String> fieldKeys = e.getFieldKeys();
        fieldKeys.add("yem_isdefaultbank");//{银行信息}--【默认】
        fieldKeys.add("yem_isdefaultlinkman");//{联系人信息}--【默认】
    }

    @Override
    public void onAddValidators(AddValidatorsEventArgs e) {
       e.addValidator(new CompanyInfoSaveValidator());
    }
}
