package com.engine.kq.wfset.util;

import com.engine.kq.biz.KQExitRulesBiz;
import com.engine.kq.biz.KQFlowActiontBiz;
import com.engine.kq.enums.DurationTypeEnum;
import com.engine.kq.wfset.bean.SplitBean;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.resource.ResourceComInfo;

public class KQFlowOutUtil {


  /**
   * 拆分公出数据 生成splitBeans
   * @param sqlMap
   * @param splitBeans
   * @param datetimeFormatter
   * @param workflowId
   * @param requestId
   * @param rci
   * @return
   * @throws Exception
   */
  public Map<String,String> handleKQOutAction(Map<String, String> sqlMap,
      List<SplitBean> splitBeans, DateTimeFormatter datetimeFormatter, int workflowId,
      int requestId, ResourceComInfo rci) throws Exception{

    KQFlowActiontBiz kqFlowActiontBiz = new KQFlowActiontBiz();
    return kqFlowActiontBiz.handleAction(sqlMap,splitBeans, datetimeFormatter, workflowId,requestId, rci,DurationTypeEnum.OUT);
  }

  /**
   * 公出流程单独需要赋值的数据
   * @param splitBean
   */
  public static void bean4Out(SplitBean splitBean) {
    String minimumUnit = Util.null2s(Util.null2String(KQExitRulesBiz.getMinimumUnit()),"-1");
    String computingMode = Util.null2s(Util.null2String(KQExitRulesBiz.getComputingMode()),"-1");
    splitBean.setDurationrule(minimumUnit);
    splitBean.setComputingMode(computingMode);
  }
}
