package shkd.repc.recon.formplugin;

import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.repc.resm.formplugin.changesupplier.bussiness.ChangeSupplierServiceImpl;


public class SupplierChangeServicePlugin extends ChangeSupplierServiceImpl {

    @Override
    public void buildChangeInfo(DynamicObject dataEntity, String entityName) {
        Object pkvalue = dataEntity.getPkValue();
        DynamicObject dataEntityOld;
        if ("resm_official_supplier".equals(entityName)) {
            dataEntityOld = dataEntity.getDynamicObject("supplier");
            pkvalue = dataEntityOld.getPkValue();
        }

        dataEntityOld = BusinessDataServiceHelper.loadSingle(pkvalue, entityName);
        this.compareBasicInfo(dataEntity, dataEntityOld);
        this.compareAptTabInfo(dataEntity, dataEntityOld);
        this.compareEvaluateTabInfo(dataEntity, dataEntityOld);
        this.compareLinkManTabInfo(dataEntity, dataEntityOld);
        this.compareBankTabInfo(dataEntity, dataEntityOld);
        this.compareAssTabInfo(dataEntity, dataEntityOld);
        this.compareEKInfo(dataEntity, dataEntityOld);
    }

    protected void compareEKInfo(DynamicObject dataEntity, DynamicObject dataEntityOld) {
        Object newValueCh = dataEntity.getString("qeug_controllingperses");
        Object oldValue = dataEntityOld.getString("qeug_controllingperses");
        String text;
        if (!newValueCh.equals(oldValue)) {
            text = this.buildText(ResManager.loadKDString("公司实际控制人/权(股份公司)", "ChangeSupplierServiceImpl_69", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue);
            this.addNewChangeEntry(dataEntity, text, "qeug_controllingperses", true);
        }

        newValueCh = dataEntity.getString("qeug_regnumberes");
        oldValue = dataEntityOld.getString("qeug_regnumberes");
        if (!newValueCh.equals(oldValue)) {
            text = this.buildText(ResManager.loadKDString("企业注册号", "ChangeSupplierServiceImpl_70", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue);
            this.addNewChangeEntry(dataEntity, text, "qeug_regnumberes", true);
        }

        newValueCh = dataEntity.getString("qeug_orgnumberes");
        oldValue = dataEntityOld.getString("qeug_orgnumberes");
        if (!newValueCh.equals(oldValue)) {
            text = this.buildText(ResManager.loadKDString("组织机构代码", "ChangeSupplierServiceImpl_71", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue);
            this.addNewChangeEntry(dataEntity, text, "qeug_orgnumberes", true);
        }

        newValueCh = dataEntity.getString("qeug_regstatuses");
        oldValue = dataEntityOld.getString("qeug_regstatuses");
        if (!newValueCh.equals(oldValue)) {
            text = this.buildText(ResManager.loadKDString("经营状态", "ChangeSupplierServiceImpl_71", "repc-resm-formplugin", new Object[0]), newValueCh, oldValue);
            this.addNewChangeEntry(dataEntity, text, "qeug_regstatuses", true);
        }
    }
}