package com.kingdee.eas.hr.affair.app;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.eas.basedata.person.*;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.framework.CoreBaseCollection;
import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryInfo;
import com.kingdee.eas.hr.affair.HRAffairBizBillEntryInfo;

public class EmpEnrollBizBillControllerBeanEx extends EmpEnrollBizBillControllerBean{

    @Override
    protected void _doWithPriorityThingEffect(Context ctx, HRAffairBizBillEntryInfo entry) throws BOSException, EASBizException {
        //super._doWithPriorityThingEffect(ctx, entry);
        EmpEnrollBillBizBean enrollBizBean = (EmpEnrollBillBizBean)this.getBizBean();
        enrollBizBean.doWithPriorityThingEffect(ctx, entry);
        this.processPersonBankRecord(ctx, entry);
        EmpEnrollBizBillEntryInfo entryInfo = (EmpEnrollBizBillEntryInfo)entry;
        String oaUserName = (String)entryInfo.get("oaUserName");
        PersonInfo person = entryInfo.getPerson();
        person.put("oaUserName",oaUserName);
        PersonFactory.getLocalInstance(ctx).save(person);
        CoreBaseCollection coreBaseCollection = new CoreBaseCollection();
        PersonHisCollection personHisCollection = PersonHisFactory.getLocalInstance(ctx).getPersonHisCollection("where number = '" + person.getNumber() + "'");
        for (int i = 0; i < personHisCollection.size(); i++) {
            PersonHisInfo personHisInfo = personHisCollection.get(i);
            personHisInfo.put("oaUserName",oaUserName);
            coreBaseCollection.add(personHisInfo);
        }
        PersonHisFactory.getLocalInstance(ctx).saveBatchData(coreBaseCollection);

    }


}
