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 WorkShiftComIndex extends ShiftComIndex {

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

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

    handleWorkTime(shiftInfoCominfoBean);
    this.success.handleDuration(shiftInfoCominfoBean);
  }

  private void handleWorkTime(ShiftInfoCominfoBean shiftInfoCominfoBean) throws Exception {
    List<Object> workTimes = (List<Object>)workTimeMap.get("workTime");
    int workmins = Util.getIntValue(Util.null2String(workTimeMap.get("workmins")));
    shiftInfoCominfoBean.setWorkmins(workmins);
    String serialid = Util.null2String(workTimeMap.get("serialid"));
    shiftInfoCominfoBean.setSerialid(serialid);

    setWorkDuration(workTimes, shiftInfoCominfoBean);

  }

}
