package nc.bs.th.th_bonus.ace.bp;

import nc.bs.th.th_bonus.plugin.bpplugin.Th_bonusPluginPoint;
import nc.impl.pubapp.pattern.data.bill.template.UpdateBPTemplate;
import nc.impl.pubapp.pattern.rule.ICompareRule;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nc.vo.th.bonus.AggbonusVO;

/**
 * 修改保存的BP
 * 
 */
public class AceTh_bonusUpdateBP {

  public AggbonusVO[] update(AggbonusVO[] bills, AggbonusVO[] originBills) {

    		    // 调用修改模板
        UpdateBPTemplate<AggbonusVO> bp = new UpdateBPTemplate<AggbonusVO>(Th_bonusPluginPoint.UPDATE);

        // 执行前规则
        this.addBeforeRule(bp.getAroundProcesser());
        return bp.update(bills, originBills);
  }
  private void addBeforeRule(CompareAroundProcesser<AggbonusVO> processer) {
   IRule<AggbonusVO> rule=null;
					  				  				   				     rule = new nc.bs.pubapp.pub.rule.FillUpdateDataRule();
				    				   				    				     				    				   				   				   				    				     processer.addBeforeRule(rule);
				    				     				  				   				     ICompareRule<AggbonusVO> ruleCom = new nc.bs.pubapp.pub.rule.UpdateBillCodeRule();
				    				   				    				     ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule)ruleCom).setCbilltype("THDJ");
				    				   				    				     ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule)ruleCom).setCodeItem("code");
				    				   				    				     ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule)ruleCom).setGroupItem("pk_group");
				    				   				    				     ((nc.bs.pubapp.pub.rule.UpdateBillCodeRule)ruleCom).setOrgItem("pk_org");
				    				   				   				   				    				     processer.addBeforeRule(ruleCom);
				    				     				  				   				     rule = new nc.bs.pubapp.pub.rule.FieldLengthCheckRule();
				    				   				    				     				    				   				   				   				    				     processer.addBeforeRule(rule);
				    				       }

}
