package vocation;

import com.engine.jucailinkq.attendance.component.persongroup.commonutil.PersongroupCommonUtil;
import com.engine.jucailinkq.attendance.enums.AccountingUnitEnum;
import com.engine.jucailinkq.attendance.vacation.service.VocationService;
import com.engine.jucailinkq.attendance.vacation.service.impl.VocationServiceImpl;
import com.engine.common.util.ServiceUtil;
import com.engine.jucailinkq.attendance.vacation.util.VocationCommonUtil;
import com.engine.jucailinkq.common.util.DateUtil;
import com.engine.jucailinkq.common.util.Utils;
import com.engine.cube.service.ModeImpExpService;
import com.engine.cube.service.impl.ModeImpExpServiceImpl;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import org.junit.Test;
import weaver.general.TimeUtil;
import weaver.hrm.User;
import workflow.beforlog;

import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class Test1 extends beforlog {
    private ModeImpExpService getService(User user) {
        return (ModeImpExpService) ServiceUtil.getService(ModeImpExpServiceImpl.class, user);
    }
    VocationService basicsetService = ServiceUtil.getService(VocationServiceImpl.class);
    @Test
    public  void test1() {
       Map<String,Object> params = Maps.newHashMap();
        Map<String,String> formmodeIdMap = Utils.getFormmodeIdMap();
        String modeId = formmodeIdMap.get("uf_jcl_kq_jqed");
        params.put("modeId",modeId);
//        params.put("releaseDate","2023-07-11");

        params.put("cover",1);
        basicsetService.generateVocation(params);
    }
    @Test
    public  void test2() throws Exception{
        Map<String,Object> params = Maps.newHashMap();
        Map<String,String> formmodeIdMap = Utils.getFormmodeIdMap();
        String modeId = formmodeIdMap.get("uf_jcl_kq_jqed");
        params.put("modeId",modeId);

        params.put("cover",1);
        basicsetService.handleOverdueVocation(params);

    }
    @Test
    public  void test3() throws Exception{
        List<Map<String,Object>> clockInTimeList = Lists.newArrayList();
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","18:01");
        }});
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","18:10");
        }});
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","18:15");
        }});
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","18:35");
        }});
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","18:50");
        }});
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","19:10");
        }});
        clockInTimeList.add(new HashMap(){{
            put("signdate","2024-07-22");
            put("signtime","19:40");
        }});

    }

    @Test
    public void test4(){
        double value =Utils.getItemduration(30,AccountingUnitEnum.MINUTES.getKey(),3.1,AccountingUnitEnum.HOUR,0);

        System.out.println(value);
    }

}
