package calendarscheduling;

import com.engine.common.util.Utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import weaver.common.DateUtil;
import weaver.general.Util;

import java.util.*;

public class Testmain {
    public static void main(String[] args) {
        List<Map<String,Object>> schedulingList = Lists.newArrayList();
        schedulingList.add(new HashMap(){{
            put("bcrq","2023-11-12");
            put("pbtj","0");
            put("pbrq","2023-11-12");
            put("pbsj","10:00");
            put("sfkt","1");
            put("id","1");
        }});
        schedulingList.add(new HashMap(){{
            put("bcrq","2023-11-12");
            put("pbtj","1");
            put("pbrq","2023-11-12");
            put("pbsj","11:00");
            put("sfkt","1");
            put("id","2");
        }});
        schedulingList.add(new HashMap(){{
            put("bcrq","2023-11-12");
            put("pbtj","2");
            put("pbrq","2023-11-12");
            put("pbsj","11:30");
            put("id","3");
        }});
        schedulingList.add(new HashMap(){{
            put("bcrq","2023-11-13");
            put("pbtj","0");
            put("pbrq","2023-11-13");
            put("pbsj","11:00");
            put("id","4");
        }});
        schedulingList.add(new HashMap(){{
            put("bcrq","2023-11-14");
            put("pbtj","0");
            put("pbrq","2023-11-14");
            put("pbsj","12:00");
            put("id","5");
        }});
        Map<String,Object> userIdMap = Maps.newHashMap();
        userIdMap.put("1","2023-11-13,2023-11-14");
        userIdMap.put("3","2023-11-15,2023-11-18");
        userIdMap.put("6","2023-11-16,2023-11-20");
        userIdMap.put("5","2023-11-16,2023-11-20");

        for (int i=0;i<schedulingList.size();i++){
            Map<String,Object> map = schedulingList.get(i);
            String id = Util.null2String(map.get("id"));
            if (userIdMap.get(id) == null){
                schedulingList.remove(i);
                i--;
            }else {
                map.put("effectTime",userIdMap.get(id));
            }
        }

        System.out.println(schedulingList);

    }
}
