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

import com.engine.kq.biz.KQTimesArrayComInfo;
import java.util.List;
import java.util.Map;
import weaver.general.Util;

/**
 * 休息时段计算类
 */
public class RestShiftComIndex extends ShiftComIndex {

  public RestShiftComIndex(String name,Map<String,Object> workTimeMap){
    super(name,workTimeMap);
  }

  @Override
  public void handleDuration(ShiftInfoCominfoBean shiftInfoCominfoBean) throws Exception {

    String isresttimeopen = Util.null2String(workTimeMap.get("isresttimeopen"));
    if("1".equalsIgnoreCase(isresttimeopen)){
      handleRestTime(shiftInfoCominfoBean);
    }
    this.success.handleDuration(shiftInfoCominfoBean);

  }

  private void handleRestTime(ShiftInfoCominfoBean shiftInfoCominfoBean) throws Exception {

    List<Object> restTimes = (List<Object>)workTimeMap.get("restTime");

    setRestDuration(restTimes, shiftInfoCominfoBean);

  }

}
