package nc.bs.pub.action;

import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.hr.baod_orders.ace.bp.AceBaod_ordersSendApproveBP;
import nc.bs.hr.baod_orders.plugin.bpplugin.Baod_ordersPluginPoint;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.th.baod.entity.AggBaodVO;
import nc.vo.pub.pf.BillStatusEnum;
import nc.vo.pub.VOStatus;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.vo.pub.pf.IPfRetCheckInfo;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.bs.framework.common.NCLocator;

public class N_YGBD_SAVE extends AbstractPfAction<AggBaodVO> {
  public N_YGBD_SAVE() {
    super();
  }

  protected CompareAroundProcesser<AggBaodVO> getCompareAroundProcesserWithRules(
	      Object userObj) {
	    CompareAroundProcesser<AggBaodVO> processor = new CompareAroundProcesser<AggBaodVO>(
	        		Baod_ordersPluginPoint.SEND_APPROVE);
	    // TODO 在此处添加审核前后规则
	   IRule<AggBaodVO> rule=null;
					  				   				     rule = new nc.bs.pubapp.pub.rule.CommitStatusCheckRule();
				   				   				    				   				   
				   				     processor.addBeforeRule(rule);
				   				   
  
				  	    return processor;
	  }
  @Override
  protected AggBaodVO[] processBP(Object userObj,AggBaodVO[] clientFullVOs,
		      AggBaodVO[] originBills) {
		      nc.itf.hr.IBaod_ordersMaintain operator = NCLocator.getInstance().lookup(nc.itf.hr.IBaod_ordersMaintain.class);
      AggBaodVO[] bills = null;
      try {
          bills=operator.save(clientFullVOs,originBills);
      } catch (BusinessException e) {
				          ExceptionUtils.wrappBusinessException(e.getMessage());
			      }
      return bills;
  }

}
