

import com.engine.common.util.DateUtil;
import com.engine.common.util.Utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import java.time.ZoneOffset;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class TestMethod {
    public static void main(String[] args) {
//        List<Map<String,Object>> detailTableData = Lists.newArrayList();
//        detailTableData.add(new HashMap(){{
//            put("ksrq","2024-02-18");
//            put("sysc","1");
//        }});
//        detailTableData.add(new HashMap(){{
//            put("ksrq","2024-01-18");
//            put("sysc","1");
//        }});
//
//        detailTableData = detailTableData.stream().sorted(Comparator.comparing(e-> DateUtil.getTime(e.get("ksrq").toString()).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
//        System.out.println(detailTableData);

        List<Map<String,Object>> list = Lists.newArrayList();
        Map<String,Object> map1 = Maps.newHashMap();
        map1.put("ksrq","2024-04-20");
        Map<String,Object> map2 = Maps.newHashMap();
        map2.put("ksrq","2024-04-21");
        Map<String,Object> map3 = Maps.newHashMap();
        map3.put("ksrq","2024-04-15");
        Map<String,Object> map4 = Maps.newHashMap();
        map4.put("ksrq","2024-04-14");
        list.add(map1);
        list.add(map2);
        list.add(map3);
        list.add(map4);
        list = list.stream().sorted(Comparator.comparing(e->DateUtil.getTime(e.get("ksrq").toString()).toInstant(ZoneOffset.of("+8")).toEpochMilli())).collect(Collectors.toList());
       // System.out.println(DateUtil.getTime("2024-04-14").toInstant(ZoneOffset.of("+8")).toEpochMilli());

        System.out.println(list);
    }
}
