package sy;

import ComprehensiveWorkingHourServiceImpl.beforlog;
import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.attendance.workflow.service.BusinessTripsApplyService;
import com.engine.jucailinkq.attendance.workflow.service.impl.BusinessTripsApplyServiceImpl;
import com.google.gson.Gson;
import org.junit.Test;
import weaver.hrm.User;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.lang.reflect.Type;

/**
 * @Author: sy
 * @Description:
 * @Date: 2024/8/7
 **/
public class testBusinessTripsApplyService extends beforlog {

    private BusinessTripsApplyService getBusinessTripsApplyService(User user) {
        return ServiceUtil.getService(BusinessTripsApplyServiceImpl.class,user);
    }
    @Test
    public void test() throws Exception {
        User user = new User();
        user.setUid(1);
        user.setLanguage(7);

        //生成出差明细表1明细
        Map<String, Object> params = new HashMap<>();
        Map<String,String> mainTableData = new HashMap<>();
        mainTableData.put("ccr", "22,24");
        mainTableData.put("ksrq", "2024-06-08");
        mainTableData.put("jsrq", "2024-06-19");
        mainTableData.put("cclx", "140");
        mainTableData.put("mttsdcc", "0");

//        //出差方式：全天
//        mainTableData.put("ccsc", null);
//        mainTableData.put("kssj", null);
//        mainTableData.put("jssj", null);
//        mainTableData.put("ccsd", "0");
        //出差方式：指定时间区间
        mainTableData.put("ccsc", "");
        mainTableData.put("kssj", "09:23");
        mainTableData.put("jssj", "17:00");
        mainTableData.put("ccsd", "1");
//        //出差方式：指定时间长度
//        mainTableData.put("ccsc", "3.1");
//        mainTableData.put("kssj", null);
//        mainTableData.put("jssj", null);
//        mainTableData.put("ccsd", "3");
//        //出差方式：半天
//        mainTableData.put("ccsc", null);
//        mainTableData.put("kssj", null);
//        mainTableData.put("jssj", null);
//        mainTableData.put("ccsd", "2");

        List<Map<String, String>> detailTableData = new ArrayList<>();
        Map<String, String> detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "599_8.0");detailDataItem.put("ksrq", "2024-06-28");detailDataItem.put("qjr", "41");detailDataItem.put("qjsc", "8.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "599_6.0,602_2.0");detailDataItem.put("ksrq", "2024-07-01");detailDataItem.put("qjr", "41");detailDataItem.put("qjsc", "8.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "602_5.0");detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "41");detailDataItem.put("qjsc", "5.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "127");detailDataItem.put("jqye", null);detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "41");detailDataItem.put("qjsc", "3.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "597_8.0");detailDataItem.put("ksrq", "2024-06-28");detailDataItem.put("qjr", "42");detailDataItem.put("qjsc", "8.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "597_4.0,603_4.0");detailDataItem.put("ksrq", "2024-07-01");detailDataItem.put("qjr", "42");detailDataItem.put("qjsc", "8.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "603_2.0");detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "42");detailDataItem.put("qjsc", "2.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "127");detailDataItem.put("jqye", null);detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "42");detailDataItem.put("qjsc", "6.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "598_8.0");detailDataItem.put("ksrq", "2024-06-28");detailDataItem.put("qjr", "43");detailDataItem.put("qjsc", "8.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "598_5.0,601_3.0");detailDataItem.put("ksrq", "2024-07-01");detailDataItem.put("qjr", "43");detailDataItem.put("qjsc", "8.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "145");detailDataItem.put("jqye", "601_7.0");detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "43");detailDataItem.put("qjsc", "7.0");
//        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
//        detailDataItem.put("qjlx", "127");detailDataItem.put("jqye", null);detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "43");detailDataItem.put("qjsc", "1.0");
//        detailTableData.add(detailDataItem);
//[{"ksrq":"2024-07-02","kssj":"","jsrq":"2024-07-02","jssj":"","qjsc":"5.00","qtj":"0","btj":"0","cxqj":"","cxly":"","cxid":"","qjr":"81","qjlx":"127","jqye":""},
// {"ksrq":"2024-07-03","kssj":"","jsrq":"2024-07-03","jssj":"","qjsc":"5.00","qtj":"0","btj":"0","cxqj":"","cxly":"","cxid":"","qjr":"81","qjlx":"127","jqye":""}]
        detailDataItem.put("qjlx", "127");detailDataItem.put("jqye", "");detailDataItem.put("ksrq", "2024-07-02");detailDataItem.put("qjr", "81");detailDataItem.put("qjsc", "5");
        detailTableData.add(detailDataItem);detailDataItem = new HashMap<>();
        detailDataItem.put("qjlx", "127");detailDataItem.put("jqye", "");detailDataItem.put("ksrq", "2024-07-03");detailDataItem.put("qjr", "81");detailDataItem.put("qjsc", "5");
        detailTableData.add(detailDataItem);

        params.put("mainTableData", mainTableData);
//        params.put("detailTableData", detailTableData);
        getBusinessTripsApplyService(user).generateBusinessTripsList(params);

    }

}
