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

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.basedata.person.PersonInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.beisen.synchronousorg.SynchronousEmpBillFactory;
import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryCollection;
import com.kingdee.eas.hr.affair.EmpEnrollBizBillEntryInfo;
import com.kingdee.eas.hr.affair.EmpEnrollBizBillFactory;
import com.kingdee.eas.hr.affair.EmpEnrollBizBillInfo;

public class EmpEnrollBizBillControllerBeanEx extends EmpEnrollBizBillControllerBean {
    @Override
    protected void _auditEntryEffect(Context ctx, BOSUuid billID) throws BOSException, EASBizException {
        super._auditEntryEffect(ctx, billID);
        System.out.println("============com.kingdee.eas.custom.hr.affair.app.EmpEnrollBizBillControllerBeanEx=================");
        try {
            String where = "select *,entrys.*,entrys.person.* where id='" + billID + "'";
            System.out.println("==================where==="+where);
            EmpEnrollBizBillInfo empEnrollBizBillInfo =
                    EmpEnrollBizBillFactory.getLocalInstance(ctx).getEmpEnrollBizBillInfo(where);
            EmpEnrollBizBillEntryCollection entrys = empEnrollBizBillInfo.getEntrys();
            String beisenid = empEnrollBizBillInfo.getString("beisenid");
            System.out.println("===========beisenid========"+beisenid);
            if (beisenid != null && beisenid.length() > 0 && entrys.size() == 1) {
                System.out.println("==========查员工==========");
                EmpEnrollBizBillEntryInfo empEnrollBizBillEntryInfo = entrys.get(0);
                PersonInfo person = empEnrollBizBillEntryInfo.getPerson();
                System.out.println("==========查员工=========="+person.getName()+"====="+person.getId());
                if (person != null) {
                    String s = SynchronousEmpBillFactory.getLocalInstance(ctx).empBill(beisenid, "002", "0044610");
                    System.out.println("=======s==="+s);
                }
            }
        } catch (Exception e) {
            System.out.println("报错--》这里的操作是同步北森数据\n同步失败不要影响员工入职所以未抛出异常\n前端可" +
                    "手动操作同步查看具体问题"+e.getMessage());
            e.printStackTrace();
        }

    }
}
