package com.engine.kq.biz.chain.duration;

import com.engine.kq.wfset.bean.SplitBean;
import com.engine.kq.wfset.util.SplitActionUtil;
import java.util.List;

/**
 * 非工作时长 按小时计算
 */
public class NonHourUnitSplitChain extends NonWorkDurationChain {


  public NonHourUnitSplitChain(List<SplitBean> splitBeans) {
    super(splitBeans);
  }



  @Override
  public void handleDuration(SplitBean splitBean) throws Exception{
    String durationrule = splitBean.getDurationrule();
    if("3".equalsIgnoreCase(durationrule) || "5".equalsIgnoreCase(durationrule)
        || "6".equalsIgnoreCase(durationrule)){
      getSplitDurationBean(splitBean);
      if(!splitBeans.isEmpty()){
        SplitActionUtil.turnOvertimeBeansWithRule(splitBeans);
      }
    }else{
      this.success.handleDuration(splitBean);
    }
  }

  @Override
  public void handleNonBreakDuration(SplitBean splitBean) throws Exception {
    String durationrule = splitBean.getDurationrule();
    if("3".equalsIgnoreCase(durationrule) || "5".equalsIgnoreCase(durationrule)
            || "6".equalsIgnoreCase(durationrule)){
      getNonBreaksSplitDurationBean(splitBean);
      if(!splitBeans.isEmpty()){
        SplitActionUtil.turnOvertimeBeansWithRule(splitBeans);
      }
    }else{
      this.success.handleDuration(splitBean);
    }
  }

}
