
package nc.bs.pub.action;

import nc.bs.framework.common.NCLocator;
import nccloud.bs.hrkq.hrkq.aggbusi.plugin.bpplugin.MonthOtTimeVOPluginPoint;
import nc.bs.pubapp.pf.action.AbstractPfAction;
import nc.bs.pubapp.pub.rule.UncommitStatusCheckRule;
import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser;
import nccloud.itf.hrkq.hrkq.IMonthottimevoMaintain;
import nc.vo.hrkq.monthottime.AggMonthOtTimeVO;
import nc.vo.pub.BusinessException;
import nc.vo.pubapp.pattern.exception.ExceptionUtils;

public class N_6QOT_UNSAVEBILL extends AbstractPfAction<AggMonthOtTimeVO> {

        @Override
        protected CompareAroundProcesser<AggMonthOtTimeVO> getCompareAroundProcesserWithRules(
                        Object userObj) {
                CompareAroundProcesser<AggMonthOtTimeVO> processor = new CompareAroundProcesser<AggMonthOtTimeVO>(
                                MonthOtTimeVOPluginPoint.UNSEND_APPROVE);
                // TODO 在此处添加前后规则
                processor.addBeforeRule(new UncommitStatusCheckRule());

                return processor;
        }

        @Override
        protected AggMonthOtTimeVO[] processBP(Object userObj,
                        AggMonthOtTimeVO[] clientFullVOs, AggMonthOtTimeVO[] originBills) {
                IMonthottimevoMaintain operator = NCLocator.getInstance().lookup(
                                IMonthottimevoMaintain.class);
                AggMonthOtTimeVO[] bills = null;
                try {
                        bills = operator.unsave(clientFullVOs, originBills);
                } catch (BusinessException e) {
                        ExceptionUtils.wrappBusinessException(e.getMessage());
                }
                return bills;
        }

}
